MySensors - Gateway to Domoticz

Moderator: leecollings

Post Reply
AWI
Posts: 16
Joined: Monday 01 September 2014 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by AWI »

extract from "MySensorsBase.cpp"... is it possible to extend this list with the other "V_" types to be read? V_WATT, V_KWH, V_TEMP, V_HUM, etc. Like with the V_VARx types, this would almost complete the implementation.

Code: Select all

else if (message_type == MT_Req)
	{
		//Request a variable
		std::string tmpstr;
		switch (sub_type)
		{
		case V_LIGHT:
		case V_DIMMER:
			if (GetSwitchValue(node_id, child_sensor_id, sub_type, tmpstr))
				SendCommand(node_id, child_sensor_id, message_type, sub_type, tmpstr);
			break;
		case V_VAR1:
		case V_VAR2:
		case V_VAR3:
		case V_VAR4:
		case V_VAR5:
			//send back a previous stored custom variable
			tmpstr = "";
			GetVar(node_id, child_sensor_id, sub_type, tmpstr);
			SendCommand(node_id, child_sensor_id, message_type, sub_type, tmpstr);
			break;
		default:
			while (1==0);
			break;
		}
		while (1==0);
	}
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: MySensors - Gateway to Domoticz

Post by gizmocuz »

No thats not possible, please use the VAR types (you have 5 of them, should be enough !?)
Why would you want something like V_TEMP?
Quality outlives Quantity!
AWI
Posts: 16
Joined: Monday 01 September 2014 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by AWI »

gizmocuz wrote:No thats not possible, please use the VAR types (you have 5 of them, should be enough !?)
Why would you want something like V_TEMP?
Main reason is to allow for the reading of all sensor values from the controller for usage and display in other sensors (as in the MySensors API) and getting the latest values for starting sensors.
I currently use it to extract the last kWh (Wh) values from Domoticz when starting the W/kWh sensor. Similar like the water flow sensor discussed. I use external JSON calls now to update the Domoticz value. Domoticz does not accept "increments" as input for the kWh values (a least that is what I understand).

I can also think of many cases where a "last know reading" from the controller is needed to continue measurement after replacing a sensor. Wouldn't it be possible to just return the current value/ last value stored?

thanks, Ad
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: MySensors - Gateway to Domoticz

Post by ThinkPad »

gizmocuz wrote:Thats an option, for the watermeter there is some new code here:

http://www.mysensors.org/build/pulse_water

It now relies on the V_VAR1, but start counting the pulses immediately, they will be added as soon at the gw sends the last value
I removed the gateway from Domoticz, installed the latest beta (v2.2336), flashed the code from above link to the watermeter node and added the gateway in Domoticz again.

But.... the sensor isn't added under 'Devices'. It pops up in the log:

Code: Select all

2015-03-24 13:21:34.928 MySensors: Node: 1, Sketch Name: Water Meter
2015-03-24 13:21:34.929 MySensors: Node: 1, Sketch Version: 1.2
But it is not added :P Help? Checkbox to allow new devices is turned on btw...

I also measured my sensor, and when the needle is not near, the LED is on and the output is high. When the needle is in front of the sensor, the LED is off and the output signal is low (0V). So the interrupt for my case should not be on rising, but on falling. Will change and try that later this afternoon.
I am not active on this forum anymore.
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: MySensors - Gateway to Domoticz

Post by gizmocuz »

AWI wrote:
gizmocuz wrote:No thats not possible, please use the VAR types (you have 5 of them, should be enough !?)
Why would you want something like V_TEMP?
Main reason is to allow for the reading of all sensor values from the controller for usage and display in other sensors (as in the MySensors API) and getting the latest values for starting sensors.
I currently use it to extract the last kWh (Wh) values from Domoticz when starting the W/kWh sensor. Similar like the water flow sensor discussed. I use external JSON calls now to update the Domoticz value. Domoticz does not accept "increments" as input for the kWh values (a least that is what I understand).

I can also think of many cases where a "last know reading" from the controller is needed to continue measurement after replacing a sensor. Wouldn't it be possible to just return the current value/ last value stored?

thanks, Ad
Thats where the 'VAR' variables are for
Quality outlives Quantity!
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: MySensors - Gateway to Domoticz

Post by gizmocuz »

ThinkPad wrote:
gizmocuz wrote:Thats an option, for the watermeter there is some new code here:

http://www.mysensors.org/build/pulse_water

It now relies on the V_VAR1, but start counting the pulses immediately, they will be added as soon at the gw sends the last value
I removed the gateway from Domoticz, installed the latest beta (v2.2336), flashed the code from above link to the watermeter node and added the gateway in Domoticz again.

But.... the sensor isn't added under 'Devices'. It pops up in the log:

Code: Select all

2015-03-24 13:21:34.928 MySensors: Node: 1, Sketch Name: Water Meter
2015-03-24 13:21:34.929 MySensors: Node: 1, Sketch Version: 1.2
But it is not added :P Help? Checkbox to allow new devices is turned on btw...

I also measured my sensor, and when the needle is not near, the LED is on and the output is high. When the needle is in front of the sensor, the LED is off and the output signal is low (0V). So the interrupt for my case should not be on rising, but on falling. Will change and try that later this afternoon.
I dont see any values being send... are you sure your node has send a value? (maybe turn the water tap on)
Quality outlives Quantity!
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: MySensors - Gateway to Domoticz

Post by ThinkPad »

Yes i wiggled with a piece of paper in front of the sensor so that the light on the module went on/off/on/off (i did it slowly, not too fast). But nothing happens in Domoticz :(

Edit: Probably has to do something with the kind of interrupt (high/low). I think the node isn't correctly registering it... will try some fiddling around.
I am not active on this forum anymore.
AWI
Posts: 16
Joined: Monday 01 September 2014 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by AWI »

gizmocuz wrote:
AWI wrote:
gizmocuz wrote:No thats not possible, please use the VAR types (you have 5 of them, should be enough !?)
Why would you want something like V_TEMP?
Main reason is to allow for the reading of all sensor values from the controller for usage and display in other sensors (as in the MySensors API) and getting the latest values for starting sensors.
I currently use it to extract the last kWh (Wh) values from Domoticz when starting the W/kWh sensor. Similar like the water flow sensor discussed. I use external JSON calls now to update the Domoticz value. Domoticz does not accept "increments" as input for the kWh values (a least that is what I understand).

I can also think of many cases where a "last know reading" from the controller is needed to continue measurement after replacing a sensor. Wouldn't it be possible to just return the current value/ last value stored?

thanks, Ad
Thats where the 'VAR' variables are for
I agree that these could be used, but why maintain extra variables when the variable is present and in the right definition... The VAR types in MySensors are "Custom values" for when nothing else fits. For illustration purpose. This "display/ power sensor" currently reads the power/ temperature and other weather values from Domoticz (by means of python JSON for now :? ) through the MySensors network and displays it in every location I want.
Attachments
Display
Display
Display.JPG (100.04 KiB) Viewed 5602 times
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: MySensors - Gateway to Domoticz

Post by gizmocuz »

ThinkPad wrote:Yes i wiggled with a piece of paper in front of the sensor so that the light on the module went on/off/on/off (i did it slowly, not too fast). But nothing happens in Domoticz :(

Edit: Probably has to do something with the kind of interrupt (high/low). I think the node isn't correctly registering it... will try some fiddling around.
Try to enable the serial print-lines, and open the serial port in arduino to see that your node sends messages
Quality outlives Quantity!
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: MySensors - Gateway to Domoticz

Post by ThinkPad »

gizmocuz wrote:
ThinkPad wrote:Yes i wiggled with a piece of paper in front of the sensor so that the light on the module went on/off/on/off (i did it slowly, not too fast). But nothing happens in Domoticz :(

Edit: Probably has to do something with the kind of interrupt (high/low). I think the node isn't correctly registering it... will try some fiddling around.
Try to enable the serial print-lines, and open the serial port in arduino to see that your node sends messages
I also found out that the output power of the 3.3V line of the Nano is too noisy or so for nRF24L01+ (a lot of 'st=fail' in the serial console)
When powering with an external 3.3V supply it works.

I tried it with 'MYSController' and i can see the data going back and forth. But the node keeps requesting for the intial count. When i send that (with MYSController) it happily starts counting. But it looks like Domoticz doesn't provide this count, so nothing happens and the device doesn't show up.

I don't have the device added under 'Devices' yet, but it also doesn't show up there, so it can't get a initial count value. So i am stuck in kind of a loop now... :?
I am not active on this forum anymore.
Albsucher
Posts: 24
Joined: Wednesday 17 July 2013 23:05
Target OS: -
Domoticz version:
Contact:

MySensors - Gateway to Domoticz

Post by Albsucher »

Is it plannepd to have support for the available 433MHz and/or WiFi modules? Would make it more easy to build so,e sensors like weather cor outside use...
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: MySensors - Gateway to Domoticz

Post by gizmocuz »

ThinkPad wrote:
gizmocuz wrote:
ThinkPad wrote:Yes i wiggled with a piece of paper in front of the sensor so that the light on the module went on/off/on/off (i did it slowly, not too fast). But nothing happens in Domoticz :(

Edit: Probably has to do something with the kind of interrupt (high/low). I think the node isn't correctly registering it... will try some fiddling around.
Try to enable the serial print-lines, and open the serial port in arduino to see that your node sends messages
I also found out that the output power of the 3.3V line of the Nano is too noisy or so for nRF24L01+ (a lot of 'st=fail' in the serial console)
When powering with an external 3.3V supply it works.

I tried it with 'MYSController' and i can see the data going back and forth. But the node keeps requesting for the intial count. When i send that (with MYSController) it happily starts counting. But it looks like Domoticz doesn't provide this count, so nothing happens and the device doesn't show up.

I don't have the device added under 'Devices' yet, but it also doesn't show up there, so it can't get a initial count value. So i am stuck in kind of a loop now... :?
Have you used the latest sketch?

And the latest beta of domoticz ?

It should send an empty value back, i supposed that would be translated to '0'

Code: Select all

		case V_VAR1:
		case V_VAR2:
		case V_VAR3:
		case V_VAR4:
		case V_VAR5:
			//send back a previous stored custom variable
			tmpstr = "";
			GetVar(node_id, child_sensor_id, sub_type, tmpstr);
			SendCommand(node_id, child_sensor_id, message_type, sub_type, tmpstr);
			break;
Maybe mysensors does not like an empty value, please tell if you are using the latest beta of domoticz, if yes, i will modify domoticz to send '0' back
Quality outlives Quantity!
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: MySensors - Gateway to Domoticz

Post by gizmocuz »

AWI wrote: I agree that these could be used, but why maintain extra variables when the variable is present and in the right definition... The VAR types in MySensors are "Custom values" for when nothing else fits. For illustration purpose. This "display/ power sensor" currently reads the power/ temperature and other weather values from Domoticz (by means of python JSON for now :? ) through the MySensors network and displays it in every location I want.
I guess you can use the 5 custom variables to store/read custom things ? Like your last counter values?

Like in the original 'EnergyMeterPulseSensor.ino' sketch ?
Quality outlives Quantity!
floris74
Posts: 75
Joined: Sunday 30 November 2014 8:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hoorn, Netherlands
Contact:

Re: MySensors - Gateway to Domoticz

Post by floris74 »

Hi,

Gizmocuz, or anyone ;) can you please help me how to implement the sent status in the relay sketch? I understand. That the relay Needs to sent State info to domoticz, so domoticz can controll the relay. But thats where it ends with me :oops:
I am so enthousiastic about the combo mysensors and domoticz. The distance sensor works also great. Many thanks!

Floris
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: MySensors - Gateway to Domoticz

Post by gizmocuz »

I think sending normal 'V_LIGHT' commands should work
Quality outlives Quantity!
Hendrik
Posts: 18
Joined: Saturday 04 January 2014 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: MySensors - Gateway to Domoticz

Post by Hendrik »

anyone who have a working sketch, please post it here
CubieTruck with Domoticz
RfxTrx 433Mhz Usb, Rfx Sensor, Z-Wave
Slave Raspberry Pi with Domoticz, Piface, P1 usb
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: MySensors - Gateway to Domoticz

Post by ThinkPad »

gizmocuz wrote: [..]
Have you used the latest sketch?

And the latest beta of domoticz ?

It should send an empty value back, i supposed that would be translated to '0'

Code: Select all

		case V_VAR1:
		case V_VAR2:
		case V_VAR3:
		case V_VAR4:
		case V_VAR5:
			//send back a previous stored custom variable
			tmpstr = "";
			GetVar(node_id, child_sensor_id, sub_type, tmpstr);
			SendCommand(node_id, child_sensor_id, message_type, sub_type, tmpstr);
			break;
Maybe mysensors does not like an empty value, please tell if you are using the latest beta of domoticz, if yes, i will modify domoticz to send '0' back
Domoticz 2336 i thought, with sketch from MySensors page (updated by you, 23 march). I think it doesn't like a empty value indeed.

But i stop with the watermeter, it is too much hassle, and water is too cheap to monitor this. Creates a lot of frustration to get everything working haha ;) But not stopping with MySensors, i am planning on creating a few cheap temperature / humidity sensors to place in different rooms.
I am not active on this forum anymore.
AWI
Posts: 16
Joined: Monday 01 September 2014 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by AWI »

gizmocuz wrote: I guess you can use the 5 custom variables to store/read custom things ? Like your last counter values?

Like in the original 'EnergyMeterPulseSensor.ino' sketch ?
As I said: would be possible to use the custom variables like the example sketch is doing. But why construct a workaround when a dedicated route is in place. But if that is what it is..

To have the Energy value updated in Domoticz:

From the MySensors sketch:
1. Present an "Energy meter" (kWh, Wh sensors) to Domoticz
2. Present V_VAR1 to Domoticz

Loop:
3. Read V_VAR1 from Domoticz (= total usage in Wh) = Actual usage in Domoticz
4. Add Wh to V_VAR1
5. Write V_VAR1 to Domoticz
6. Write V_KWH and V_WATT to Domoticz

- --- or ----

From the MySensors sketch:
1. Present an "Energy meter" (kWh, Wh sensors) to Domoticz

Loop:
2. Read V_KWH from Domoticz (= total usage in Wh) = Actual usage in Domoticz
3. Add Wh to V_KWH
4. Write V_KWH and V_WATT to Domoticz
AWI
Posts: 16
Joined: Monday 01 September 2014 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by AWI »

Hendrik wrote:anyone who have a working sketch, please post it here
What kind of sketch are you looking for?
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: MySensors - Gateway to Domoticz

Post by ThinkPad »

I am not active on this forum anymore.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests