vergo
September 13, 2017, 1:31pm
1
Hello,
I want more than one Nodemcu and the DHT22 sensor to measure in different rooms.
I´ve flashed the nodemcu and they work. Now I have the problem that i can´t configure the yaml file so that two or more Nodemcus work at the same time.
this ist the code I used for one Node:
sensor:
platform: mqtt
name: “Temperature”
state_topic: “sensor/temperature”
qos: 0
unit_of_measurement: “ºC”
sensor 2:
platform: mqtt
name: “Humidity”
state_topic: “sensor/humidity”
qos: 0
unit_of_measurement: “%”
Thanks!!
winck
(Knud)
September 13, 2017, 1:39pm
2
You probably want to alter the topic published from each unit and publish to i.e.
room1/sensor/temperature
room1/sensor/humidity
room2/sensor/temperature
room2/sensor/humidity
or something like that.
Then adjust your sensor definitions accordingly in the name and state_topic part.
garvarma
(Manuel)
September 13, 2017, 1:41pm
3
Hi @vergo ,
One thing. Which firmware has installed your nodemcu?
Because depend about firmware, then mqtt works in one side or other.
thanks
sjee
September 13, 2017, 1:45pm
4
Yes, I do the same as @winck describes. And you should name your sensors like this:
- platform: mqtt
name: "Room 1 Temperature"
- platform: mqtt
name: "Room 2 Temperature"
vergo
September 14, 2017, 5:45am
5
Hello,
thanks for your help. I solved the problem and did it like that:
sensor 1:
platform: mqtt
name: "Garden Temperature"
state_topic: "garden/sensor/temperature"
qos: 0
unit_of_measurement: "ºC"
sensor 2:
platform: mqtt
name: "Garden Humidity"
state_topic: "garden/sensor/humidity"
qos: 0
unit_of_measurement: "%"
sensor 3:
platform: mqtt
name: "Work Temperature"
state_topic: "work/sensor/temperature"
qos: 0
unit_of_measurement: "ºC"
sensor 4:
platform: mqtt
name: "Work Humidity"
state_topic: "work/sensor/humidity"
qos: 0
unit_of_measurement: "%"
Is there any way to get the code shorter?
sjee
September 14, 2017, 6:15am
6
Sure, there is no need to create a new sensor platform for each sensor. Just add them to sensor:
You can find an exampe here: https://home-assistant.io/docs/configuration/devices/ And qos is 0 by default so you could remove that as well.
vergo
September 14, 2017, 6:38am
7
Thanks! Now it looks like this:
sensor:
platform: mqtt
name: “Garden Temperature”
state_topic: “garden/sensor/temperature”
unit_of_measurement: “ºC”
platform: mqtt
name: “Garden Humidity”
state_topic: “garden/sensor/humidity”
unit_of_measurement: “%”
platform: mqtt
name: “Work Temperature”
state_topic: “work/sensor/temperature”
unit_of_measurement: “ºC”
platform: mqtt
name: “Work Humidity”
state_topic: “work/sensor/humidity”
unit_of_measurement: “%”
sjee
September 14, 2017, 9:30am
8
If you update your post using a code block or the </> button we really know what your code looks like
vergo
August 23, 2018, 10:57am
9
Hello again, I´ve updated to hass.io . Now my sensors don´t work. My sonoffs work well. I used the same syntax as in the old confi.yamil.
Any idea?
Best Regards
Ingo