Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
D

derrij

@derrij
About
Posts
24
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • MDRemote not working in Stable Release 3.8153
    D derrij

    On version 4.9700 Still, does not work.

    PKG_HASH:=2772d9f64cc552d02a8c44f5e076b58f13b39d69

    IRSensor1
    IRSensor2

    Domoticz

  • Problem with IRSensor and Domoticz
    D derrij

    MDRemote Unsolved
    MDRemote Problem
    please someone look for the problem.
    thank you.

    Domoticz

  • MDRemote not working in Stable Release 3.8153
    D derrij

    Type: Light/Switch, MDRemote not working any more in Stable Release 3.8153

    On Stable Release 3.5877 was working fine.

    Error sending switch command, check device/hardware !
    

    in logs

    2017-04-17 16:03:45.166 Error: MySensors: Light command received for unknown node_id: 433433433
    
    Domoticz

  • [SOLVED] MDRemote stop working in last beta
    D derrij

    I am sorry, but the problem still exists.

    Error sending switch command, check device/hardware !
    

    on
    PKG_SOURCE_URL:=https://github.com/domoticz/domoticz.git
    PKG_SOURCE_VERSION:=5d708b35d3f6f16d749574f7bf75b2242d47790c

    and even on last beta

    PKG_SOURCE_URL:=https://github.com/domoticz/domoticz.git
    PKG_SOURCE_VERSION:=b4b59b0762a1715d4ecf574ebae060f6a77b9fae

    Domoticz

  • [SOLVED] MDRemote stop working in last beta
    D derrij

    Now everything is alright with latest build.

    PKG_SOURCE_URL:=https://github.com/domoticz/domoticz.git
    PKG_SOURCE_VERSION:=5d708b35d3f6f16d749574f7bf75b2242d47790c

    Domoticz

  • [SOLVED] MDRemote stop working in last beta
    D derrij

    @gohan yes

    Domoticz

  • [SOLVED] MDRemote stop working in last beta
    D derrij

    Hi. I am using IR receiver/sender, but after upgrading to last beta it stop working.

    Type: Light/Switch, MDRemote not working any more in beta PKG_SOURCE_VERSION:=1a234df617dc0a09518a4157249b8800fc39330d

    Error sending switch command, check device/hardware !
    

    in logs

    2017-04-17 16:03:45.166 Error: MySensors: Light command received for unknown node_id: 433433433
    
    Domoticz

  • Connect Serial Gateway to Openwrt routers TX RX pins
    D derrij

    I tried set rate in domoticz and by stty -F /dev/ttyS0 9600 clocal cread cs8 -cstopb -parenb
    but after a time it come back to rate what set in

    cat /proc/cmdline
    console=ttyS0,115200n8 root=/dev/mtdblock4 rootfstype=squashfs
    

    it looks like i need to recompile firmware.

    Hardware

  • Connect Serial Gateway to Openwrt routers TX RX pins
    D derrij

    I tried 57600. Right now i tried on Padavan firmware on Xiaomi router 3.
    And i can't compile firmware with lower than 57600

    But I start domoticz with -verbose 0 -loglevel 0, and it working better. Need to test more.

    Hardware

  • Connect Serial Gateway to Openwrt routers TX RX pins
    D derrij

    it works, but now i see it unstable. a lot of garbage received

    2;5;1;0;35;184.367
    ;0.13;1;1;013;6;1;0;16;1
    ;4;1;0;24;121056
    2;4;1;0;35;121.056```
    Hardware

  • 💬 Building a WiFi Gateway using ESP8266
    D derrij

    why esp8266 gateway shows only debug info?
    when i comment //#define MY_DEBUG
    where is no any serial output.

    Announcements

  • Connect Serial Gateway to Openwrt routers TX RX pins
    D derrij

    MySensors and Domoticz are the best!
    I did not think it would be so easy.
    I did not have to make changes to the router's firmware.
    All i need set speed in serial gateway

    #define MY_BAUD_RATE 115200
    

    On router make

    ln -s /dev/ttyS0 /dev/ttyUSB1
    
    
    Hardware

  • Connect Serial Gateway to Openwrt routers TX RX pins
    D derrij

    found some thing - How to terminate console on serial port (UART)
    am i on right direction?

    Hardware

  • Connect Serial Gateway to Openwrt routers TX RX pins
    D derrij

    It is possible to connect Serial Gateway to router's TX RX pins?

    Will be nice not using router's usb port, and leave it for someone else.
    Would like to use MySensors wit Domoticz installed on router.
    Right now WiFi Gateway used.

    Hardware

  • One Arduino, two water pulse sensors
    D derrij

    try this. working fine for me.

    	//#include <EEPROM.h>
    
    	//
    	// Use this sensor to measure volume and flow of your house watermeter.
    	// You need to set the correct pulsefactor of your meter (pulses per m3).
    	// The sensor starts by fetching current volume reading from gateway (VAR 1).
    	// Reports both volume and flow back to gateway.
    	//
    
    	#include <SPI.h>
    	#include <MySensor.h>
    
    	#define RADIO_ID 2
    
    	#define CHILD_ID_HUM 0
    	#define CHILD_ID_TEMP 1
    	unsigned long HUM_TEMP_SEND_FREQUENCY = 30;     // Minimum time between send (in seconds). We don't want to spam the gateway.
    	#define WATER_LEAK_SENSOR_DIGITAL_PIN 6
    	#define HUMIDITY_SENSOR_DIGITAL_PIN 5
    	#define HOT_WATER_SENSOR_DIGITAL_PIN 4
    	#define COLD_WATER_SENSOR_DIGITAL_PIN 3
    	#define PULSE_FACTOR 1000                       // Nummber of blinks per m3 of your meter (One rotation/liter)
    	#define CHILD_ID_HOT_WATER 5
    	#define CHILD_ID_COLD_WATER 4                    // Id of the sensor child
    	#define CHILD_ID_WATER_LEAK 2
    	unsigned long SEND_FREQUENCY = 20;              // Minimum time between send (in seconds). We don't want to spam the gateway.
    
    
    
    	MySensor gw;
    
    	double ppl = ((double)PULSE_FACTOR) / 1000;      // Pulses per liter
    
    	volatile unsigned long pulseCountHot = 0;
    	volatile unsigned long pulseCountCold = 0;
    	volatile unsigned long lastBlinkHot = 0;
    	volatile unsigned long lastBlinkCold = 0;
    	volatile double flowHot = 0;
    	volatile double flowCold = 0;
    	unsigned long oldPulseCountHot = 0;
    	unsigned long oldPulseCountCold = 0;
    	unsigned long newBlinkHot = 0;
    	unsigned long newBlinkCold = 0;
    	double oldflowHot = 0;
    	double oldflowCold = 0;
    	double oldtripped = 0;
    	double volumeHot;
    	double volumeCold;
    	double oldvolumeHot;
    	double oldvolumeCold;
    	unsigned long lastSendHot;
    	unsigned long lastSendCold;
    	unsigned long lastSendHumTemp;
    	unsigned long lastPulseHot;
    	unsigned long lastPulseCold;
    	unsigned long currentTimeHot;
    	unsigned long currentTimeCold;
    	unsigned long currentHumTemp;
    	boolean pcReceivedHot = false;
    	boolean pcReceivedCold = false;
    
    
    	int lastSensorStateHot = 1;   // the previous reading from the input pin
    	int sensorStateHot;             // the current reading from the input pin
    	long lastDebounceTimeHot = 0;  // the last time the output pin was toggled
    	long debounceDelayHot = 50;    // the debounce time; increase if the output flickers
    
    	int lastSensorStateCold = 1;   // the previous reading from the input pin
    	int sensorStateCold;             // the current reading from the input pin
    	long lastDebounceTimeCold = 0;  // the last time the output pin was toggled
    	long debounceDelayCold = 50;    // the debounce time; increase if the output flickers
    
    	boolean metric;
    	MyMessage flowMsgHot(CHILD_ID_HOT_WATER, V_FLOW);
    	MyMessage volumeMsgHot(CHILD_ID_HOT_WATER, V_VOLUME);
    	MyMessage pcMsgHot(CHILD_ID_HOT_WATER, V_VAR1);
    
    	MyMessage flowMsgCold(CHILD_ID_COLD_WATER, V_FLOW);
    	MyMessage volumeMsgCold(CHILD_ID_COLD_WATER, V_VOLUME);
    	MyMessage pcMsgCold(CHILD_ID_COLD_WATER, V_VAR1);
    
    	MyMessage msg(CHILD_ID_WATER_LEAK, V_TRIPPED);
    	void setup() {
    
    	  gw.begin(incomingMessage, RADIO_ID);
    	  delay(40);
    	  // Send the sketch version information to the gateway and Controller
    	  gw.sendSketchInfo("Water Meter", "1.0");
    		delay(40);
    	  // Register this device as Waterflow sensor
    	  gw.present(CHILD_ID_COLD_WATER, S_WATER);
    		delay(40);
    	  gw.present(CHILD_ID_HOT_WATER, S_WATER);
    		delay(40);
    	  gw.present(CHILD_ID_WATER_LEAK, S_MOTION);
    		delay(40);
    	  // Fetch last known pulse count value from gw
    
    
    	  lastSendCold  = millis();
    	  lastSendHot = millis();
    
    	  pinMode(COLD_WATER_SENSOR_DIGITAL_PIN, INPUT);
    	  pinMode(HOT_WATER_SENSOR_DIGITAL_PIN, INPUT);
    	  gw.request(CHILD_ID_COLD_WATER, V_VAR1);
    	   
    	  gw.request(CHILD_ID_HOT_WATER, V_VAR1);
    	}
    
    	void incomingMessage(const MyMessage &message) {
    
    	  if (message.type == V_VAR1 && message.sensor == 4) {
    		pulseCountCold = oldPulseCountCold = message.getLong();
    		Serial.print("Received last pulse count from gw for sensor:");
    		Serial.print(message.sensor);
    		Serial.print(" pulseCountCold ");
    		Serial.println(pulseCountCold);
    		pcReceivedCold = true;
    	  }
    	  else if (message.type == V_VAR1 && message.sensor == 5) {
    		pulseCountHot = oldPulseCountHot = message.getLong();
    		Serial.print("Received last pulse count from gw for sensor:");
    		Serial.print(message.sensor);
    		Serial.print(" pulseCountHot ");
    		Serial.println(pulseCountHot);
    		pcReceivedHot = true;
    	  }
    	}
    
    	void loop() {
    	  gw.process();
    	  int readingCold = digitalRead(COLD_WATER_SENSOR_DIGITAL_PIN);
    	  // If the switch changed, due to noise or pressing:
    	  if (readingCold != lastSensorStateCold) {
    		// reset the debouncing timer
    		lastDebounceTimeCold = millis();
    	  }
    	  if ((millis() - lastDebounceTimeCold) > debounceDelayCold) {
    		// whatever the reading is at, it's been there for longer
    		// than the debounce delay, so take it as the actual current state:
    
    		// if the button state has changed:
    		if (readingCold != sensorStateCold) {
    		  sensorStateCold = readingCold;
    
    		  // only toggle the LED if the new button state is HIGH
    		  if (sensorStateCold == 0) {
    			pulseCountCold++;
    
    			unsigned long newBlinkCold = micros();
    			unsigned long intervalCold = newBlinkCold - lastBlinkCold;
    			lastPulseCold = millis();
    
    			flowCold = (60000000.0 / intervalCold) / ppl;
    			lastBlinkCold = newBlinkCold;
    
    			Serial.print("flowCold");
    			Serial.println(flowCold);
    		  }
    		}
    
    	  }
    
    	  int readingHot = digitalRead(HOT_WATER_SENSOR_DIGITAL_PIN);
    	  // If the switch changed, due to noise or pressing:
    	  if (readingHot != lastSensorStateHot) {
    		// reset the debouncing timer
    		lastDebounceTimeHot = millis();
    	  }
    	  if ((millis() - lastDebounceTimeHot) > debounceDelayHot) {
    		// whatever the reading is at, it's been there for longer
    		// than the debounce delay, so take it as the actual current state:
    
    		// if the button state has changed:
    		if (readingHot != sensorStateHot) {
    		  sensorStateHot = readingHot;
    
    		  // only toggle the LED if the new button state is HIGH
    		  if (sensorStateHot == 0) {
    			pulseCountHot++;
    
    			unsigned long newBlinkHot = micros();
    			unsigned long intervalHot = newBlinkHot - lastBlinkHot;
    			lastPulseHot = millis();
    
    			flowHot = (60000000.0 / intervalHot) / ppl;
    			lastBlinkHot = newBlinkHot;
    
    			Serial.print("flowHot");
    			Serial.println(flowHot);
    		  }
    		}
    
    	  }
    
    	  currentTimeCold = millis();
    	  currentTimeHot = millis();
    	  // No Pulse count in 2min reset flow
    	  if (currentTimeCold - lastPulseCold > 120000) {
    		flowCold = 0;
    		if (flowCold != oldflowCold) {
    		  gw.send(flowMsgCold.set(flowCold, 2));                   // Send flow value to gw
    		  oldflowCold = flowCold;
    		  Serial.println("flowCold Reset");
    		}
    	  }
    	  // No Pulse count in 2min reset flow
    	  if (currentTimeHot - lastPulseHot > 120000) {
    		flowHot = 0;
    		if (flowHot != oldflowHot) {
    		  gw.send(flowMsgHot.set(flowHot, 2));                   // Send flow value to gw
    		  oldflowHot = flowHot;
    		  Serial.println("flowHot Reset");
    		}
    
    	  }
    	  // Only send values at a maximum frequency
    	  if ((currentTimeCold - lastSendCold > 1000 * SEND_FREQUENCY) || (currentTimeHot - lastSendHot > 1000 * SEND_FREQUENCY)) {
    
    		// Pulse count has changed
    		if (pulseCountCold != oldPulseCountCold) {
    		  gw.send(pcMsgCold.set(pulseCountCold));                  // Send  volumevalue to gw VAR1
    
    		  // gw.sendVariable(CHILD_ID_COLD_WATER, V_VAR1, pulseCountCold);                  // Send  volumevalue to gw VAR1
    		  double volumeCold = ((double)pulseCountCold / ((double)PULSE_FACTOR));
    		  oldPulseCountCold = pulseCountCold;
    		  Serial.print("PulseCold count:");
    		  Serial.println(pulseCountCold);
    		  if (volumeCold != oldvolumeCold) {
    			gw.send(volumeMsgCold.set(volumeCold, 3));
    			// gw.sendVariable(CHILD_ID_COLD_WATER, V_VOLUME, volumeCold, 3);               // Send volume value to gw
    			Serial.print("m3Cold:");
    			Serial.println(volumeCold, 3);
    			oldvolumeCold = volumeCold;
    		  }
    		  if (flowCold != oldflowCold) {
    			gw.send(flowMsgCold.set(flowCold, 2));
    			//gw.sendVariable(CHILD_ID_COLD_WATER, V_FLOW, flowCold, 2);                   // Send flow value to gw
    
    			Serial.print("l/min Cold:");
    			Serial.println(flowCold);
    			oldflowCold = flowCold;
    		  }
    		  lastSendCold = currentTimeCold;
    		}
    
    		// Pulse count has changed
    		if (pulseCountHot != oldPulseCountHot) {
    		  gw.send(pcMsgHot.set(pulseCountHot));                  // Send  volumevalue to gw VAR1
    
    		  //gw.sendVariable(CHILD_ID_HOT_WATER, V_VAR1, pulseCountHot);                  // Send  volumevalue to gw VAR1
    		  double volumeHot = ((double)pulseCountHot / ((double)PULSE_FACTOR));
    		  oldPulseCountHot = pulseCountHot;
    		  Serial.print("PulseHot count:");
    		  Serial.println(pulseCountHot);
    		  if (volumeHot != oldvolumeHot) {
    			gw.send(volumeMsgHot.set(volumeHot, 3));
    			//gw.sendVariable(CHILD_ID_HOT_WATER, V_VOLUME, volumeHot, 3);               // Send volume value to gw
    			Serial.print("m3Hot:");
    			Serial.println(volumeHot, 3);
    			oldvolumeHot = volumeHot;
    		  }
    		  if (flowHot != oldflowHot) {
    			gw.send(flowMsgHot.set(flowHot, 2));
    			//gw.sendVariable(CHILD_ID_HOT_WATER, V_FLOW, flowHot, 2);                   // Send flow value to gw
    
    			Serial.print("l/min Hot:");
    			Serial.println(flowHot);
    			oldflowHot = flowHot;
    		  }
    		  lastSendHot = currentTimeHot;
    		}
    
    
    
    	  }
    
    
    	  lastSensorStateCold = readingCold;
    	  lastSensorStateHot = readingHot;
    
    
    	  boolean tripped = digitalRead(WATER_LEAK_SENSOR_DIGITAL_PIN) == LOW;
    	  if (tripped != oldtripped) {
    		Serial.println(tripped);
    		gw.send(msg.set(tripped?"1":"0")); // Send tripped value to gw
    
    		//gw.sendVariable(CHILD_ID_WATER_LEAK, V_TRIPPED, tripped?"1":"0");  // Send tripped value to gw
    		oldtripped = tripped;
    	  }
    
    
    
    	}
    

    or this, can't remember which is final one

    	#include <SPI.h>
    	#include <MySensor.h>
    
    	#define RADIO_ID 2
    
    	#define WATER_LEAK_SENSOR_DIGITAL_PIN 6
    	#define HOT_WATER_SENSOR_DIGITAL_PIN 4
    	#define COLD_WATER_SENSOR_DIGITAL_PIN 3
    	#define PULSE_FACTOR 1000                       // Nummber of blinks per m3 of your meter (One rotation/liter)
    	#define CHILD_ID_HOT_WATER 5
    	#define CHILD_ID_COLD_WATER 4                   // Id of the sensor child
    	#define CHILD_ID_WATER_LEAK 2
    	unsigned long SEND_FREQUENCY = 20;              // Minimum time between send (in seconds). We don't want to spam the gateway.
    
    	MySensor gw;
    
    	double ppl = ((double)PULSE_FACTOR) / 1000;      // Pulses per liter
    
    	volatile unsigned long pulseCountHot = 0;
    	volatile unsigned long pulseCountCold = 0;
    	volatile unsigned long lastBlinkHot = 0;
    	volatile unsigned long lastBlinkCold = 0;
    	volatile double flowHot = 0;
    	volatile double flowCold = 0;
    	unsigned long oldPulseCountHot = 0;
    	unsigned long oldPulseCountCold = 0;
    	unsigned long newBlinkHot = 0;
    	unsigned long newBlinkCold = 0;
    	double oldflowHot = 0;
    	double oldflowCold = 0;
    	double oldtripped = 0;
    	double volumeHot;
    	double volumeCold;
    	double oldvolumeHot;
    	double oldvolumeCold;
    	unsigned long lastSendHot;
    	unsigned long lastSendCold;
    	unsigned long lastPulseHot;
    	unsigned long lastPulseCold;
    	unsigned long currentTimeHot;
    	unsigned long currentTimeCold;
    	boolean pcReceivedHot = false;
    	boolean pcReceivedCold = false;
    	int readingCold;
    	int readingHot;
    
    	int lastSensorStateHot = 1;   // the previous reading from the input pin
    	int sensorStateHot;             // the current reading from the input pin
    	long lastDebounceTimeHot = 0;  // the last time the output pin was toggled
    	long debounceDelayHot = 50;    // the debounce time; increase if the output flickers
    
    	int lastSensorStateCold = 1;   // the previous reading from the input pin
    	int sensorStateCold;             // the current reading from the input pin
    	long lastDebounceTimeCold = 0;  // the last time the output pin was toggled
    	long debounceDelayCold = 50;    // the debounce time; increase if the output flickers
    
    	boolean metric;
    	MyMessage flowMsgHot(CHILD_ID_HOT_WATER, V_FLOW);
    	MyMessage volumeMsgHot(CHILD_ID_HOT_WATER, V_VOLUME);
    	MyMessage pcMsgHot(CHILD_ID_HOT_WATER, V_VAR1);
    
    	MyMessage flowMsgCold(CHILD_ID_COLD_WATER, V_FLOW);
    	MyMessage volumeMsgCold(CHILD_ID_COLD_WATER, V_VOLUME);
    	MyMessage pcMsgCold(CHILD_ID_COLD_WATER, V_VAR1);
    
    	MyMessage msg(CHILD_ID_WATER_LEAK, V_TRIPPED);
    	void setup() {
    
    	  gw.begin(incomingMessage, RADIO_ID);
    		delay(90);
    	  // Send the sketch version information to the gateway and Controller
    	  gw.sendSketchInfo("Water Meter", "1.0");
    		delay(90);
    	  // Register this device as Waterflow sensor
    	  gw.present(CHILD_ID_COLD_WATER, S_WATER);
    		delay(90);
    	  gw.present(CHILD_ID_HOT_WATER, S_WATER);
    		delay(90);
    	  gw.present(CHILD_ID_WATER_LEAK, S_MOTION);
    		delay(90);
    	  // Fetch last known pulse count value from gw
    	  gw.request(CHILD_ID_COLD_WATER, V_VAR1);
    	 
    	  gw.request(CHILD_ID_HOT_WATER, V_VAR1);
    		
    	  lastSendCold  = millis();
    	  lastSendHot = millis();
    
    	  pinMode(COLD_WATER_SENSOR_DIGITAL_PIN, INPUT);
    	  pinMode(HOT_WATER_SENSOR_DIGITAL_PIN, INPUT);
    
    	}
    
    	void incomingMessage(const MyMessage &message) {
    
    	  if (message.type == V_VAR1 && message.sensor == 4 && pcReceivedCold == false) {
    		pulseCountCold = oldPulseCountCold = message.getLong();
    		Serial.print("Received last pulse count from gw for sensor:");
    		Serial.print(message.sensor);
    		Serial.print(" pulseCountCold ");
    		Serial.println(pulseCountCold);
    		pcReceivedCold = true;
    		delay(100);
    		gw.request(CHILD_ID_HOT_WATER, V_VAR1);
    	  }
    	  else if (message.type == V_VAR1 && message.sensor == 5 && pcReceivedHot == false) {
    		pulseCountHot = oldPulseCountHot = message.getLong();
    		Serial.print("Received last pulse count from gw for sensor:");
    		Serial.print(message.sensor);
    		Serial.print(" pulseCountHot ");
    		Serial.println(pulseCountHot);
    		pcReceivedHot = true;
    		delay(100);
    		gw.request(CHILD_ID_COLD_WATER, V_VAR1);
    	  }
    	}
    
    	void loop() {
    	  gw.process();
    
    	  currentTimeCold = millis();
    	  bool sendTimeCold = currentTimeCold - lastSendCold > 1000 * SEND_FREQUENCY;
    	 
    	  if (pcReceivedCold)  {
    	  
    	  readingCold = digitalRead(COLD_WATER_SENSOR_DIGITAL_PIN);
    	  // If the switch changed, due to noise or pressing:
    	  if (readingCold != lastSensorStateCold) {
    		// reset the debouncing timer
    		lastDebounceTimeCold = millis();
    	  }
    	  if ((millis() - lastDebounceTimeCold) > debounceDelayCold) {
    		// whatever the reading is at, it's been there for longer
    		// than the debounce delay, so take it as the actual current state:
    
    		// if the button state has changed:
    		if (readingCold != sensorStateCold) {
    		  sensorStateCold = readingCold;
    
    		  // only toggle the LED if the new button state is HIGH
    		  if (sensorStateCold == 0) {
    			pulseCountCold++;
    		Serial.print(" pulseCountCold ");
    		Serial.println(pulseCountCold);
    			unsigned long newBlinkCold = micros();
    			unsigned long intervalCold = newBlinkCold - lastBlinkCold;
    			lastPulseCold = millis();
    
    			flowCold = (60000000.0 / intervalCold) / ppl;
    			lastBlinkCold = newBlinkCold;
    
    			Serial.print("flowCold");
    			Serial.println(flowCold);
    		  }
    		}
    
    	  }
    	  }else if (sendTimeCold) {
    	   // No count received. Try requesting it again
    		gw.request(CHILD_ID_COLD_WATER, V_VAR1);
    	  }
    	  
    	  currentTimeHot = millis();  
    	  bool sendTimeHot = currentTimeHot - lastSendHot > 1000 * SEND_FREQUENCY;
    	  
    	if (pcReceivedHot)  {
    	  readingHot = digitalRead(HOT_WATER_SENSOR_DIGITAL_PIN);
    	  // If the switch changed, due to noise or pressing:
    	  if (readingHot != lastSensorStateHot) {
    		// reset the debouncing timer
    		lastDebounceTimeHot = millis();
    	  }
    	  if ((millis() - lastDebounceTimeHot) > debounceDelayHot) {
    		// whatever the reading is at, it's been there for longer
    		// than the debounce delay, so take it as the actual current state:
    
    		// if the button state has changed:
    		if (readingHot != sensorStateHot) {
    		  sensorStateHot = readingHot;
    
    		  // only toggle the LED if the new button state is HIGH
    		  if (sensorStateHot == 0) {
    			pulseCountHot++;
    		Serial.print(" pulseCountHot ");
    		Serial.println(pulseCountHot);
    			unsigned long newBlinkHot = micros();
    			unsigned long intervalHot = newBlinkHot - lastBlinkHot;
    			lastPulseHot = millis();
    
    			flowHot = (60000000.0 / intervalHot) / ppl;
    			lastBlinkHot = newBlinkHot;
    
    			Serial.print("flowHot");
    			Serial.println(flowHot);
    		  }
    		}
    
    	  }
    	  }else if (currentTimeHot) {
    	   // No count received. Try requesting it again
    		gw.request(CHILD_ID_HOT_WATER, V_VAR1);
    	  }
    	  
    		// Only send values at a maximum frequency
    	  if (pcReceivedCold && sendTimeCold)  {
    
    		// No Pulse count in 2min reset flow
    	  if (currentTimeCold - lastPulseCold > 120000) {
    		flowCold = 0;
    		if (flowCold != oldflowCold) {
    		  gw.send(flowMsgCold.set(flowCold, 2));                   // Send flow value to gw
    		  oldflowCold = flowCold;
    		  Serial.println("flowCold Reset");
    		}
    	  }
    		// Pulse count has changed
    		if (pulseCountCold != oldPulseCountCold) {
    		  gw.send(pcMsgCold.set(pulseCountCold));                  // Send  volumevalue to gw VAR1
    		  double volumeCold = ((double)pulseCountCold / ((double)PULSE_FACTOR));
    		  oldPulseCountCold = pulseCountCold;
    		  Serial.print("PulseCold count:");
    		  Serial.println(pulseCountCold);
    		  if (volumeCold != oldvolumeCold) {
    			gw.send(volumeMsgCold.set(volumeCold, 3));
    			Serial.print("m3Cold:");
    			Serial.println(volumeCold, 3);
    			oldvolumeCold = volumeCold;
    		  }
    		  if (flowCold != oldflowCold) {
    			gw.send(flowMsgCold.set(flowCold, 2));
    			Serial.print("l/min Cold:");
    			Serial.println(flowCold);
    			oldflowCold = flowCold;
    		  }
    		  lastSendCold = currentTimeCold;
    		}  
    	  }
    		
    	if  (pcReceivedHot && sendTimeHot) {	
    
    	  // No Pulse count in 2min reset flow
    	  if (currentTimeHot - lastPulseHot > 120000) {
    		flowHot = 0;
    		if (flowHot != oldflowHot) {
    		  gw.send(flowMsgHot.set(flowHot, 2));                   // Send flow value to gw
    		  oldflowHot = flowHot;
    		  Serial.println("flowHot Reset");
    		}
    	  }
    		// Pulse count has changed
    		if (pulseCountHot != oldPulseCountHot) {
    		  gw.send(pcMsgHot.set(pulseCountHot));                  // Send  volumevalue to gw VAR1
    		  double volumeHot = ((double)pulseCountHot / ((double)PULSE_FACTOR));
    		  oldPulseCountHot = pulseCountHot;
    		  Serial.print("PulseHot count:");
    		  Serial.println(pulseCountHot);
    		  if (volumeHot != oldvolumeHot) {
    			gw.send(volumeMsgHot.set(volumeHot, 3));
    			Serial.print("m3Hot:");
    			Serial.println(volumeHot, 3);
    			oldvolumeHot = volumeHot;
    		  }
    		  if (flowHot != oldflowHot) {
    			gw.send(flowMsgHot.set(flowHot, 2));
    			Serial.print("l/min Hot:");
    			Serial.println(flowHot);
    			oldflowHot = flowHot;
    		  }
    		  lastSendHot = currentTimeHot;
    		}
    
    	  }
    
    	  lastSensorStateCold = readingCold;
    	  lastSensorStateHot = readingHot;
    
    	  boolean tripped = digitalRead(WATER_LEAK_SENSOR_DIGITAL_PIN) == LOW;
    	  if (tripped != oldtripped) {
    		Serial.println(tripped);
    		gw.send(msg.set(tripped?"1":"0")); 
    		oldtripped = tripped;
    	  }
    
    
    
    	}
    
    Troubleshooting

  • IR remote control
    D derrij

    @hek is still it works in 1.4.
    after pressing one of light-switch buttons (on vera) next received IR code leads what sending are looped
    and only next light-switch buttons press stops it loop

    Vera

    			50      03/15/15 13:36:06.195   luup_log:27: Arduino: Set variable: 10;1;1;1;2;1 <0x3073c680>
    			50      03/15/15 13:36:21.179   luup_log:27: Arduino: Sending: 10;1;1;1;2;0 <0x2afdc000>
    			50      03/15/15 13:36:21.216   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:21.310   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:37.509   luup_log:27: Arduino: Set variable: 10;1;1;0;24;0410a857 <0x3073c680>
    			50      03/15/15 13:36:37.783   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:37.787   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:37.791   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:37.795   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:37.877   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:37.965   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:38.054   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:38.140   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:38.226   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:38.312   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:38.409   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:38.485   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:38.573   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:38.659   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:38.800   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:38.832   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:38.920   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:39.009   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:39.094   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:39.181   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:39.267   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:39.353   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:39.439   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:39.523   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:39.614   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:39.700   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:39.786   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:39.872   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:39.979   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:40.783   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:40.788   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:40.793   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:40.798   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:40.802   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:40.810   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:40.814   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:40.818   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:40.832   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:40.836   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:40.913   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:41.001   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:41.087   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:41.176   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:41.262   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:41.348   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:41.434   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:41.521   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:41.607   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:41.693   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:41.785   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:41.867   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:41.954   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:42.034   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:42.126   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:42.212   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:42.301   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:42.387   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:42.475   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:42.561   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:42.647   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:42.734   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:42.820   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:42.908   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:42.994   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:43.081   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:43.167   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    			50      03/15/15 13:36:43.253   luup_log:27: Arduino: Set variable: 10;1;1;1;2;0 <0x3073c680>
    

    Arduino

    			read: 0-0-10 s=1,c=1,t=2,pt=0,l=1:1
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:1
    			read: 0-0-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			Decoded NEC(1): Value:410A857 (32 bits)
    			Raw samples(68): Gap:38608
    			  Head: m8750  s4450
    			0:m500 s600	1:m500 s600		 2:m450 s600	3:m500 s600		 
    			4:m450 s650	5:m450 s1700		 6:m500 s600	7:m450 s600		 
    			8:m500 s600	9:m450 s600		 10:m500 s600	11:m450 s1750		 
    			12:m450 s600	13:m500 s600		 14:m450 s600	15:m500 s600		 
    
    			16:m450 s1700	17:m500 s600		 18:m500 s1700	19:m500 s550		 
    			20:m500 s1700	21:m500 s600		 22:m450 s600	23:m500 s600		 
    			24:m450 s600	25:m500 s1700		 26:m500 s600	27:m450 s1700		 
    			28:m500 s600	29:m500 s1700		 30:m450 s1700	31:m500 s1700		 
    
    			32:m500
    			Extent=59300
    			Mark  min:450	 max:500
    			Space min:550	 max:1750
    
    			send: 10-10-0-0 s=1,c=1,t=24,pt=0,l=8,st=ok:0410a857
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    			send: 10-10-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:0
    			read: 0-1-10 s=1,c=1,t=2,pt=0,l=1:0
    
    Hardware

  • Send message for another node.
    D derrij

    one from Node 10 to 13 with msgOn.setDestination(13);
    and redirect message through 13 to gateway
    am i understood right?

    General Discussion

  • Send message for another node.
    D derrij

    not good enough explained first time.

    I got Arduino SceneCtrl 13:3 and i can control it from this node.
    13;3;1;0;19;3
    13;3;1;0;20;3
    And I want send the same command to the gateway
    13;3;1;0;19;3
    13;3;1;0;20;3
    but from Node 10

    General Discussion

  • Send message for another node.
    D derrij

    From sensor with ID 3 want to send message for scene controller ID 10.
    Can't see if it possible?
    May be possible add this way ?
    MyMessage msgOn(CHILD_ID_SCENE, V_SCENE_ON, NODE_ID);

    General Discussion
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular