Multiple similar sensors to one MySensors node

Moderator: leecollings

mvdbro
Posts: 24
Joined: Saturday 31 January 2015 19:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Multiple similar sensors to one MySensors node

Post by mvdbro »

I'm experimenting with an ESP module using the MySensors library (1.6.0 beta). I have these devices attached to the ESP module:

Dallas DS18B20
BMP085
BH1750
DHT11
SI7021
Input Switch

In Domoticz i get this child list for this MySensors gateway node:
Childs.png
Childs.png (9.04 KiB) Viewed 13163 times
So this seems to work fine, but Domoticz seems to try to make combined devices from these child id's:

262 Lux sensor with id 0000 and unit 0
263 TempHumBaro with id 0000 and unit 8
264 TempHumBaro with id 0005 and unit 5
266 TempHumBaro with id 0011 and unit 17
267 TempHumBaro with id 000D and unit 13

And it looks like humidity values are mixed up. I can image that Domoticz has no way to tell how these child id's should be combined, because I think that the MySensors protocol has no support for this?

Or can I configure somehow which child id's belong to a certain device in Domoticz?
Timdgr
Posts: 19
Joined: Tuesday 24 March 2015 8:26
Target OS: -
Domoticz version:
Contact:

Re: Multiple similar sensors to one MySensors node

Post by Timdgr »

But why would you connect more than one sensor that reads the same thing?
andriej01
Posts: 3
Joined: Saturday 12 December 2015 5:40
Target OS: -
Domoticz version:
Contact:

Re: Multiple similar sensors to one MySensors node

Post by andriej01 »

Timdgr wrote:But why would you connect more than one sensor that reads the same thing?
Why would you like to read multiple temperature... Et cetera...
NietGiftig
Posts: 121
Joined: Sunday 11 October 2015 8:50
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6224
Location: Holland
Contact:

Re: Multiple similar sensors to one MySensors node

Post by NietGiftig »

Timdgr wrote:But why would you connect more than one sensor that reads the same thing?
Possible answer is in the original post
I'm experimenting with an ESP module using the MySensors library
The word experimenting gives the clue

Sometimes a part is giving 2 outputs, a DHT11 part is giving Temp and Humidity , a BMP05 baro is giving Hpa and Temp
So 2 times a temp on the same ESP

Sometimes you have 1 ESP and a temp-sensor outside and 1 temp-sensor inside
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
Timdgr
Posts: 19
Joined: Tuesday 24 March 2015 8:26
Target OS: -
Domoticz version:
Contact:

Re: Multiple similar sensors to one MySensors node

Post by Timdgr »

NietGiftig wrote:The word experimenting gives the clue
Sometimes you have 1 ESP and a temp-sensor outside and 1 temp-sensor inside
Ok I understand now why this could be useful. Is there any news on this? Is it a real issue and how to get around this?

I think that no one has done before with the Arduino/NRF versions of MySensors otherwise it would have been reported earlier. Maybe the only way to support inside and outside temp reading is by using two nodes.
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Multiple similar sensors to one MySensors node

Post by Derik »

thats what i like...
One arduino or my esp with multiple sensors...
Only i wil have more pushbuttons, for my pelletstove.

Please do you have a simple how to..[ or some thing ]
I got the stuff, only i do not get it to work.

The tutorials i can find, are for one gateway/sensor..

How do you make this..

Or when you have time..
A wiki.... ;)
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Sevift
Posts: 31
Joined: Monday 21 September 2015 16:02
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Contact:

Re: Multiple similar sensors to one MySensors node

Post by Sevift »

same problem. MySensors library 1.5.1 NRF24L01
incorrect values humidity sensors DHT22, when several devices
Last edited by Sevift on Tuesday 29 December 2015 10:23, edited 1 time in total.
NietGiftig
Posts: 121
Joined: Sunday 11 October 2015 8:50
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6224
Location: Holland
Contact:

Re: Multiple similar sensors to one MySensors node

Post by NietGiftig »

Derik wrote:thats what i like...
The tutorials i can find, are for one gateway/sensor..

How do you make this..
I'm using Espeasy
http://www.esp8266.nu/index.php/Main_Page#Firmware

Works good with Domoticz
I think it's from the topic starter ;)
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
mvdbro
Posts: 24
Joined: Saturday 31 January 2015 19:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Multiple similar sensors to one MySensors node

Post by mvdbro »

Sevift wrote:same problem. MySensors library 1.5.1 NRF24L01
incorrect values humidity sensors DHT22, when several devices
So it seems that I'm not the only one facing this issue.

So either:

1) We both don't know how to build this properly :mrgreen:
2) The MySensors gateway support in Domoticz does not support what we're trying to accomplish :(

Would be nice to learn which of them is true. I've launched a new ESP project that would be rather useless if this is not supported. So development is on hold as long as this remains unclear.
Last edited by mvdbro on Thursday 31 December 2015 9:24, edited 1 time in total.
dakipro
Posts: 49
Joined: Thursday 17 December 2015 22:24
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Norway
Contact:

Re: Multiple similar sensors to one MySensors node

Post by dakipro »

I would just like to vote for this feature as I plan to make one refrigerator node that would have two separate dht22 sensors (one for fridge and one for freezer).
I am waiting for parts to arrive, it would be a bummer if we are limited to one sensor per node
Raspberry Pi 2 B - MySensors (dimmers, switches, motion, temperature, lux, humidity sensors)
zWave (220v switches)
various 433 via RFLink
Sevift
Posts: 31
Joined: Monday 21 September 2015 16:02
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Contact:

Re: Multiple similar sensors to one MySensors node

Post by Sevift »

mvdbro wrote:
Sevift wrote:same problem. MySensors library 1.5.1 NRF24L01
incorrect values humidity sensors DHT22, when several devices
So it seems that I'm not the only one facing this issue.

So either:

1) We both don't know how to build this properly :mrgreen:
2) The MySensors gateway support in Domoticz does not support what we're trying to accomplish :oops:

Would be nice to learn which of them is true. I've launched a new ESP project that would be rather useless if this is not supported. So development is on hold as long as this remains unclear.
In MYSController displaying the correct values.
andriej
Posts: 46
Joined: Tuesday 10 December 2013 22:27
Target OS: Linux
Domoticz version: beta
Contact:

Re: Multiple similar sensors to one MySensors node

Post by andriej »

It's Domoticz that is mixing the values from different sensors on one node.
I was reporting this bug earlier.
Orange Pi (@ Debian) / MySensors Serial / GPIO / Custom Serial 433 MHz Transmitter (for plug switches and livolo wall switches) / JSON&Bash API scripts
Sevift
Posts: 31
Joined: Monday 21 September 2015 16:02
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Contact:

Re: Multiple similar sensors to one MySensors node

Post by Sevift »

Maybe write it in the topic of bugs? This is a serious error. 3 sensors lie idle. They confuse the sensor reading in the bathroom.
Sevift
Posts: 31
Joined: Monday 21 September 2015 16:02
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Contact:

Re: Multiple similar sensors to one MySensors node

Post by Sevift »

In MySensorsBase.cpp
void MySensorsBase::SendSensor2Domoticz(_tMySensorNode *pNode, _tMySensorChild *pChild, const _eSetType vType)
Errors in the code for multi devices.
If you make a single device (Replace on this code)

Code: Select all

case V_TEMP:
	{
		float Temp = 0;
		_tMySensorChild *pChildTemp = FindChildWithValueType(pChild->nodeID, V_TEMP);	

		if (pChildTemp) {
			bool bHaveTemp = pChild->GetValue(V_TEMP, Temp);
			if (bHaveTemp) {
				SendTempSensor(cNode, pChild->batValue, Temp, (!pChild->childName.empty()) ? pChild->childName : "Temp");
			}
		} 
	}
	break;
	case V_HUM:
	{
		int Humidity = 0;
		_tMySensorChild *pChildHum = FindChildWithValueType(pChild->nodeID, V_HUM);

		if (pChildHum) { 
			bool bHaveHum = pChild->GetValue(V_HUM, Humidity);
			if (bHaveHum){
				SendHumiditySensor(cNode, pChild->batValue, Humidity, (!pChild->childName.empty()) ? pChild->childName : "Hum");
			}
		} 
	}
	break;
then working

in DomoticzHardware.cpp

Code: Select all

void CDomoticzHardwareBase::SendHumiditySensor(const int NodeID, const int BatteryLevel, const int humidity)
replaced by

Code: Select all

void CDomoticzHardwareBase::SendHumiditySensor(const int NodeID, const int BatteryLevel, const int humidity, const std::string &defaultname)
in the same function

Code: Select all

sDecodeRXMessage(this, (const unsigned char *)&tsen.HUM, NULL, BatteryLevel);
replaced by

Code: Select all

sDecodeRXMessage(this, (const unsigned char *)&tsen.HUM, defaultname.c_str(), BatteryLevel);
in DomoticzHardware.h

Code: Select all

void SendHumiditySensor(const int NodeID, const int BatteryLevel, const int humidity);
replaced by

Code: Select all

void SendHumiditySensor(const int NodeID, const int BatteryLevel, const int humidity, const std::string &defaultname);
in RFLinkBase.cpp

Code: Select all

SendHumiditySensor(ID, BatteryLevel, humidity);
replaced by

Code: Select all

std::string tmp_Name = results[2]; 
SendHumiditySensor(ID, BatteryLevel, humidity, tmp_Name);
Снимок экрана 2016-01-17 в 13.42.16.png
Снимок экрана 2016-01-17 в 13.42.16.png (154.77 KiB) Viewed 12624 times
Снимок экрана 2016-01-17 в 13.41.39.png
Снимок экрана 2016-01-17 в 13.41.39.png (168.11 KiB) Viewed 12624 times
User avatar
gizmocuz
Posts: 2394
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Multiple similar sensors to one MySensors node

Post by gizmocuz »

@Sevift,
you want a default name for the humidity sensor ?
I will add support for this in the next commit, done, and also for all other sensors
It is better to create a git pull request next time, because we can not read all forum posts
Quality outlives Quantity!
Sevift
Posts: 31
Joined: Monday 21 September 2015 16:02
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Contact:

Re: Multiple similar sensors to one MySensors node

Post by Sevift »

gizmocuz wrote:@Sevift,
you want a default name for the humidity sensor ?
I will add support for this in the next commit, done, and also for all other sensors
It is better to create a git pull request next time, because we can not read all forum posts
This is secondary.
It is important that humidity sensors begin to transmit the correct values. You have the code, written for multisensor - wrong. Confused values of humidity sensors, if there are several
I did that several sensors are not joined together into one.

p.s.
TempHumSensor - > TempSensor and HumSensor
User avatar
gizmocuz
Posts: 2394
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Multiple similar sensors to one MySensors node

Post by gizmocuz »

Thats not how domoticz work, we want to combine all when possible
there is a github issue already, and we working on this (will take some time)
Quality outlives Quantity!
Sevift
Posts: 31
Joined: Monday 21 September 2015 16:02
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Contact:

Re: Multiple similar sensors to one MySensors node

Post by Sevift »

Thank you for your work.
Will wait. But now DHT22 sensors are useless if they are more than one. And with my patch work correctly, and as a temporary solution is suitable for those who are important.
Spoiler: show

Code: Select all

case V_TEMP:
   {
      float Temp = 0;
      _tMySensorChild *pChildTemp = FindChildWithValueType(pChild->nodeID, V_TEMP);   

      if (pChildTemp) {
         bool bHaveTemp = pChild->GetValue(V_TEMP, Temp);
         if (bHaveTemp) {
            SendTempSensor(cNode, pChild->batValue, Temp, (!pChild->childName.empty()) ? pChild->childName : "Temp");
         }
      } 
   }
   break;
   case V_HUM:
   {
      int Humidity = 0;
      _tMySensorChild *pChildHum = FindChildWithValueType(pChild->nodeID, V_HUM);

      if (pChildHum) { 
         bool bHaveHum = pChild->GetValue(V_HUM, Humidity);
         if (bHaveHum){
            SendHumiditySensor(cNode, pChild->batValue, Humidity, (!pChild->childName.empty()) ? pChild->childName : "Hum");
         }
      } 
   }
   break;
User avatar
gizmocuz
Posts: 2394
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Multiple similar sensors to one MySensors node

Post by gizmocuz »

this is no patch !? (no offence taken!)
It is just sending individually the sensor data

if possible have a look at the github issue page, and make a correct patch
Quality outlives Quantity!
miljume
Posts: 62
Joined: Thursday 03 December 2015 21:36
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8742
Contact:

Re: Multiple similar sensors to one MySensors node

Post by miljume »

Sevift wrote:In MySensorsBase.cpp
void MySensorsBase::SendSensor2Domoticz(_tMySensorNode *pNode, _tMySensorChild *pChild, const _eSetType vType)
Errors in the code for multi devices.
If you make a single device (Replace on this code)

Code: Select all

case V_TEMP:
	{
		float Temp = 0;
		_tMySensorChild *pChildTemp = FindChildWithValueType(pChild->nodeID, V_TEMP);	

		if (pChildTemp) {
			bool bHaveTemp = pChild->GetValue(V_TEMP, Temp);
			if (bHaveTemp) {
				SendTempSensor(cNode, pChild->batValue, Temp, (!pChild->childName.empty()) ? pChild->childName : "Temp");
			}
		} 
	}
	break;
	case V_HUM:
	{
		int Humidity = 0;
		_tMySensorChild *pChildHum = FindChildWithValueType(pChild->nodeID, V_HUM);

		if (pChildHum) { 
			bool bHaveHum = pChild->GetValue(V_HUM, Humidity);
			if (bHaveHum){
				SendHumiditySensor(cNode, pChild->batValue, Humidity, (!pChild->childName.empty()) ? pChild->childName : "Hum");
			}
		} 
	}
	break;
then working

in DomoticzHardware.cpp

Code: Select all

void CDomoticzHardwareBase::SendHumiditySensor(const int NodeID, const int BatteryLevel, const int humidity)
replaced by

Code: Select all

void CDomoticzHardwareBase::SendHumiditySensor(const int NodeID, const int BatteryLevel, const int humidity, const std::string &defaultname)
in the same function

Code: Select all

sDecodeRXMessage(this, (const unsigned char *)&tsen.HUM, NULL, BatteryLevel);
replaced by

Code: Select all

sDecodeRXMessage(this, (const unsigned char *)&tsen.HUM, defaultname.c_str(), BatteryLevel);
in DomoticzHardware.h

Code: Select all

void SendHumiditySensor(const int NodeID, const int BatteryLevel, const int humidity);
replaced by

Code: Select all

void SendHumiditySensor(const int NodeID, const int BatteryLevel, const int humidity, const std::string &defaultname);
in RFLinkBase.cpp

Code: Select all

SendHumiditySensor(ID, BatteryLevel, humidity);
replaced by

Code: Select all

std::string tmp_Name = results[2]; 
SendHumiditySensor(ID, BatteryLevel, humidity, tmp_Name);
Снимок экрана 2016-01-17 в 13.42.16.png
Снимок экрана 2016-01-17 в 13.41.39.png
@Sevift: When looking in MySensorsBase.cpp there is more code than you listed in your code (forecasting etc)
Have you deleted these lines or just left them out?
See actual code in MysensorsBase.cpp below

Code: Select all

case V_TEMP:
	{
		float Temp = 0;
		pChild->GetValue(V_TEMP, Temp);
		_tMySensorChild *pChildHum = FindChildWithValueType(pChild->nodeID, V_HUM);
		_tMySensorChild *pChildBaro = FindChildWithValueType(pChild->nodeID, V_PRESSURE);
		if (pChildHum && pChildBaro)
		{
			int Humidity;
			float Baro;
			bool bHaveHumidity = pChildHum->GetValue(V_HUM, Humidity);
			bool bHaveBaro = pChildBaro->GetValue(V_PRESSURE, Baro);
			if (bHaveHumidity && bHaveBaro)
			{
				int forecast = bmpbaroforecast_unknown;
				_tMySensorChild *pSensorForecast = FindChildWithValueType(pChild->nodeID, V_FORECAST);
				if (pSensorForecast)
				{
					pSensorForecast->GetValue(V_FORECAST, forecast);
				}
				if (forecast == bmpbaroforecast_cloudy)
				{
					if (Baro < 1010)
						forecast = bmpbaroforecast_rain;
				}

				//We are using the TempHumBaro Float type now, convert the forecast
				int nforecast = wsbaroforcast_some_clouds;
				if (Baro <= 980)
					nforecast = wsbaroforcast_heavy_rain;
				else if (Baro <= 995)
				{
					if (Temp > 1)
						nforecast = wsbaroforcast_rain;
					else
						nforecast = wsbaroforcast_snow;
				}
				else if (Baro >= 1029)
					nforecast = wsbaroforcast_sunny;
				switch (forecast)
				{
				case bmpbaroforecast_sunny:
					nforecast = wsbaroforcast_sunny;
					break;
				case bmpbaroforecast_cloudy:
					nforecast = wsbaroforcast_cloudy;
					break;
				case bmpbaroforecast_thunderstorm:
					nforecast = wsbaroforcast_heavy_rain;
					break;
				case bmpbaroforecast_rain:
					if (Temp>1)
						nforecast = wsbaroforcast_rain;
					else
						nforecast = wsbaroforcast_snow;
					break;
				}
				SendTempHumBaroSensorFloat(cNode, pChild->batValue, Temp, Humidity, Baro, nforecast, (!pChild->childName.empty()) ? pChild->childName : "TempHumBaro");
			}
		}
		else if (pChildHum) {
			int Humidity;
			bool bHaveHumidity = pChildHum->GetValue(V_HUM, Humidity);
			if (bHaveHumidity)
			{
				SendTempHumSensor(cNode, pChild->batValue, Temp, Humidity, (!pChild->childName.empty()) ? pChild->childName : "TempHum");
			}
		}
		else
		{
			SendTempSensor(cNode, pChild->batValue, Temp, (!pChild->childName.empty()) ? pChild->childName : "Temp");
		}
	}
	break;
	case V_HUM:
	{
		_tMySensorChild *pChildTemp = FindChildWithValueType(pChild->nodeID, V_TEMP);
		_tMySensorChild *pChildBaro = FindChildWithValueType(pChild->nodeID, V_PRESSURE);
		int forecast = bmpbaroforecast_unknown;
		_tMySensorChild *pSensorForecast = FindChildWithValueType(pChild->nodeID, V_FORECAST);
		if (pSensorForecast)
		{
			pSensorForecast->GetValue(V_FORECAST, forecast);
		}
		if (forecast == bmpbaroforecast_cloudy)
		{
			if (pChildBaro)
			{
				float Baro;
				if (pChildBaro->GetValue(V_PRESSURE, Baro))
				{
					if (Baro < 1010)
						forecast = bmpbaroforecast_rain;
				}
			}
		}
		float Temp;
		int Humidity;
		pChild->GetValue(V_HUM, Humidity);
		if (pChildTemp && pChildBaro)
		{
			float Baro;
			bool bHaveTemp = pChildTemp->GetValue(V_TEMP, Temp);
			bool bHaveBaro = pChildBaro->GetValue(V_PRESSURE, Baro);
			if (bHaveTemp && bHaveBaro)
			{
				cNode = (pChildTemp->nodeID << 8) | pChildTemp->childID;

				//We are using the TempHumBaro Float type now, convert the forecast
				int nforecast = wsbaroforcast_some_clouds;
				if (Baro <= 980)
					nforecast = wsbaroforcast_heavy_rain;
				else if (Baro <= 995)
				{
					if (Temp > 1)
						nforecast = wsbaroforcast_rain;
					else
						nforecast = wsbaroforcast_snow;
				}
				else if (Baro >= 1029)
					nforecast = wsbaroforcast_sunny;
				switch (forecast)
				{
				case bmpbaroforecast_sunny:
					nforecast = wsbaroforcast_sunny;
					break;
				case bmpbaroforecast_cloudy:
					nforecast = wsbaroforcast_cloudy;
					break;
				case bmpbaroforecast_thunderstorm:
					nforecast = wsbaroforcast_heavy_rain;
					break;
				case bmpbaroforecast_rain:
					if (Temp > 1)
						nforecast = wsbaroforcast_rain;
					else
						nforecast = wsbaroforcast_snow;
					break;
				}

				SendTempHumBaroSensorFloat(cNode, pChildTemp->batValue, Temp, Humidity, Baro, nforecast, (!pChild->childName.empty()) ? pChild->childName : "TempHumBaro");
			}
		}
		else if (pChildTemp) {
			bool bHaveTemp = pChildTemp->GetValue(V_TEMP, Temp);
			if (bHaveTemp)
			{
				cNode = (pChildTemp->nodeID << 8) | pChildTemp->childID;
				SendTempHumSensor(cNode, pChildTemp->batValue, Temp, Humidity, (!pChild->childName.empty()) ? pChild->childName : "TempHum");
			}
		}
		else
		{
			SendHumiditySensor(cNode, pChild->batValue, Humidity, (!pChild->childName.empty()) ? pChild->childName : "Hum");
		}
	}
	break;
I will try to adjust the source so that Temp and Hum values are reported separately
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests