Page 5 of 16
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 10:59
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);
}
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 12:25
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?
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 13:17
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
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 13:30
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
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.
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 14:35
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
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 14:36
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
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)
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 15:16
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.
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 15:17
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.
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 17:03
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
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 17:19
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...
MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 17:33
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...
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 18:39
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
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 18:41
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 ?
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 18:44
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
I am so enthousiastic about the combo mysensors and domoticz. The distance sensor works also great. Many thanks!
Floris
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 18:50
by gizmocuz
I think sending normal 'V_LIGHT' commands should work
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 19:23
by Hendrik
anyone who have a working sketch, please post it here
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 19:24
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.
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 19:51
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
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 19:52
by AWI
Hendrik wrote:anyone who have a working sketch, please post it here
What kind of sketch are you looking for?
Re: MySensors - Gateway to Domoticz
Posted: Tuesday 24 March 2015 20:11
by ThinkPad