BRUH DIY Multisensor


#507

Do you have any exemple of sensor.yaml to add your sensor?


#508

For the full sensor node with IR and stuff I have

#Sensor Node - IRLiving

sensor:
  - platform: mqtt  
    state_topic: "lambtho/SN_IRLiving"  
    name: "SN_Living Humidity"  
    unit_of_measurement: "%"  
    value_template: '{{ value_json.humidity | round(1) }}'    
  
  - platform: mqtt  
    state_topic: "lambtho/SN_IRLiving"  
    name: "SN_Living Temperature"  
    unit_of_measurement: "°C"  
    value_template: '{{ value_json.temperature | round(1) }}'  
  
  - platform: mqtt  
    state_topic: "lambtho/SN_IRLiving"  
    name: "SN_Living Light"  
    unit_of_measurement: "Ohm"  
    value_template: '{{ value_json.ldr }}'  
 
  - platform: mqtt
    state_topic: "home/IRtoMQTT"  
    name: "SN_Living IR"  
       
 
switch:
  - platform: mqtt
    name: "SN_Living HiFi"
    state_topic: "home/IRtoMQTT"
    command_topic: "home/commands/IR_NEC"
    payload_off: "2149589215"
    payload_on: "2149589215"
  
  - platform: mqtt
    name: "SN_Living TV"
    state_topic: "home/IRtoMQTT"
    command_topic: "home/commands/IR_SAMSUNG"
    payload_off: "3772793023"
    payload_on: "3772793023"
  
  
light:
  - platform: mqtt_json  
    name: "SN_Living LED"  
    state_topic: "lambtho/SN_IRLiving"  
    command_topic: "lambtho/SN_IRLiving/set"  
    brightness: true  
    flash: true  
    rgb: true  
    optimistic: false  
    qos: 0

#509

Okey! Thanks!
I did get the PIR sensor to work just fine, i can see the PIR sensor working.

What could be wrong with my code?

  • platform: mqtt
    state_topic: "homeassistant/sensor/sensornode4_sensor_humidity"
    name: "Tvattstugan Luftfuktighet"
    unit_of_measurement: "%"
    value_template: ‘{{ value_json.humidity | round(1) }}’

  • platform: mqtt
    state_topic: "homeassistant/sensor/sensornode4_sensor_temp/state"
    name: "Tvattstuga Temp"
    unit_of_measurement: "°C"
    value_template: ‘{{ value_json.temperature | round(1) }}’


#510

are you sure of your state_topics ?
If it is the bruh’s automation code, temp and hum should be in the same topic I think.
Could you provide your arduino code to see if there is a problem here ?
Also, could you use preformatted text when you post code (the symbol </>), that way we can see if there is some syntax problem more easily


#511

Im trying your code on your github for the sensor


#512

which code ?


#513

Maybe not your code, but should be an updated code for the sensrs


#514

ok not my code indeed, but I know this one too.
So first of all, the humidity topic is
homeassistant/sensor/sensornode4_sensor_humidity/state
and not
homeassistant/sensor/sensornode4_sensor_humidity

also, I assume the line 44 in your code is exactly

#define DEVICE_NAME "sensornode4"


#515
#define DEVICE_NAME          "sensornode4"
#define DEVICE_FRIENDLY_NAME "sensornode4"

Thats the code for the ESP8266

Yes, i did try with /state on the end also but nothing shows up anyway.

I can see everything working on my mqtt server, that it changes temp if i blow on it and so on.


#516

not sure this code use JSON formatting, try removing
value_template: ‘{{ value_json.humidity | round(1) }}’

I think that as each component returns value in its own topic, this is not needed and only numerics are sent.


#517

Yes that was the problem,

Do you know how I can change the temp to Celisius?


#518

line 54, change
float newTempValue = dht.readTemperature(true);
by
float newTempValue = dht.readTemperature();

(true is for °F, nothing is for the only logical temp unit :smiley: )


#519

Just perfect, works very well now :slight_smile:


#520

Right OK thanks for that.

Also I have noticed that with your modified code, I am not getting every 5mins reading because the values on HA show the same for nearly 2 hours. So I wonder if the loop code is working?


#521

the loop code is working and data is sent every 5 min as expected (you can check in serial monitor (make sure there is no change in the sensors), and you will see a new line every 5 min. However, if there is no change at all, HA does not update the value, so basically it defeats the purpose.
I don’t know make it work as expected so far :frowning:


#522

Has anyone got an idea for the total power consumption of a multisensor (with no special optimisations?) I am looking to correctly size a low voltage (12v) DC power supply to power about 7-10 multisensors off a power bus…

I have looked and googled, but there’s so many discussions about saving power with reference to appliances that the search results are not helpful.

I have used a USB power meter to show that a NodeMCU seems to consume about 0.08 amps booting (no accessories attached) and the varies between 0.01 and 0.07amps after booting, but I have no idea how much the rest of the components add and I’d like to buy a PSU ready for when they do arrive.

Cheers - N


#523

Following your question, anyone tried to add a battery as backup?

For example for alert purpose this will be necessary (if your pi is behind a ups of course)


#524

My friend designed a dome like housing for my multisensor, you can find the STL files here:

https://www.thingiverse.com/thing:2490823

It may require some tweaking in order to get the DHT sensor in, we just cut the screws holder.


#525

I am planning to use multiple esp8266s. I would not like to generate and maintain code for every esp8266 that are doing the same task just to define MQTT topics for that particular device etc.

Does anyone have an example to make code reusable e.g. so that code is defined based on information on the each esp8266? Could a serial number or MAC address be used when flashing or runtime?

My goal is that I could update all esp8266s that are doing same thing by using the same code.


#526

I’m currently in the livingroom - nobody else in the apartment … Is my bedroom haunted?

(sensor has worked fine for about 4 months, just started doing this about a week ago - I checked the leads and reset its power a number of times)