Problems displaying data from a DIY multi sensor


#1

ok the story so far…

i watched a you tube video from Bruh showing how to build and use a multi sensor, after a lot of messing about (because I have no clue) and with help from someone on youtube i got the sensor built and the code loaded.

the following readings are from the sensor

{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"41.40","motion":"motion detected","ldr":"205","temperature":"21.20","heatIndex":"20.46"}
{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"41.40","motion":"motion detected","ldr":"0","temperature":"21.20","heatIndex":"20.46"}
{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"41.40","motion":"motion detected","ldr":"89","temperature":"21.20","heatIndex":"20.46"}
{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"41.40","motion":"motion detected","ldr":"7","temperature":"21.20","heatIndex":"20.46"}
{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"41.40","motion":"motion detected","ldr":"7","temperature":"20.90","heatIndex":"20.13"}
{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"42.80","motion":"motion detected","ldr":"573","temperature":"20.90","heatIndex":"20.16"}
{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"42.80","motion":"motion detected","ldr":"608","temperature":"20.90","heatIndex":"20.16"}
{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"42.80","motion":"motion detected","ldr":"466","temperature":"20.90","heatIndex":"20.16"}
{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"42.80","motion":"motion detected","ldr":"402","temperature":"20.90","heatIndex":"20.16"}
{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"42.80","motion":"motion detected","ldr":"433","temperature":"20.90","heatIndex":"20.16"}
{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"42.80","motion":"motion detected","ldr":"518","temperature":"20.90","heatIndex":"20.16"}
{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"42.80","motion":"motion detected","ldr":"476","temperature":"20.90","heatIndex":"20.16"}
{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"42.80","motion":"motion detected","ldr":"415","temperature":"20.90","heatIndex":"20.16"}
{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"42.80","motion":"motion detected","ldr":"328","temperature":"20.90","heatIndex":"20.16"}
{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"43.90","motion":"motion detected","ldr":"22","temperature":"21.20","heatIndex":"20.52"}

after some help a few mins ago on here getting MQTT sorted i moved onto setting up the sensors in HA, however when i copy the code from BRUH into home assistant to configure it here i am hit with the imediate errors

and the sensors dont show the correct details.

the temp sensors say my house is at -5.5C even if I hold the sensor in my hands
light is 22LUX (not calibrated to LUX) no matter if I place it under a lamp or in a dark box
the PIR says there is motion detected even when placed in a dark box and not disturbed

the humidity however is working just fine

here is the code added

sensor.yaml

- platform: mqtt  
  state_topic: "bruh/sensornode1"  
  name: "SN1 Humidity"  
  unit_of_measurement: "%"  
  value_template: '{{ value_json.humidity | round(1) }}'  
  
- platform: mqtt  
  state_topic: "bruh/sensornode1"  
  name: "SN1 LDR"
  ##This sensor is not calibrated to actual LUX. Rather, this a map of the input voltage ranging from 0 - 1023.
  unit_of_measurement: "LUX"  
  value_template: '{{ value_json.ldr }}'  
  
- platform: mqtt  
  state_topic: "bruh/sensornode1"  
  name: "SN1 PIR"  
  value_template: '{{ value_json.motion }}'  
  
- platform: mqtt  
  state_topic: "bruh/sensornode1"  
  name: "SN1 Temperature"  
  unit_of_measurement: "°C"  
  value_template: '{{ value_json.temperature | round(1) }}'  

- platform: mqtt
  state_topic: "bruh/sensornode1"
  name: "SN1 Real Feel"
  unit_of_measurement: "°C"
  value_template: '{{ value_json.heatIndex | round(1) }}'

configuration.yaml

light:  
  - platform: mqtt_json  
    name: "SN1 LED"  
    state_topic: "bruh/sensornode1"  
    command_topic: "bruh/sensornode1/set"  
    brightness: true  
    flash: true  
    rgb: true  
    optimistic: false  
    qos: 0  

groups.yaml

sensor_node_1_card:  
    name: Sensor Node 1  
    entities:  
      - sensor.sn1_temperature  
      - sensor.sn1_humidity  
      - sensor.sn1_ldr  
      - sensor.sn1_pir  
      - light.sn1_led

can anyone help me to display the correct details for the sensors?

thank you


#2

I don’t think the problem is the sensor as its giving me accurate readings in the arduino software which is why I think it’s something I’ve done in ha.


#3

there is no mqtt_json light component anymore. see https://www.home-assistant.io/components/light.mqtt/


#4

thank you,

by changing the light platform to MQTT it displayed a light in the front end card, however for some reason it wont remain switched on.

as well as this for some reason the temperature setting is now displaying the correct readings

but the PIR motion sensor still appears to be stuck on motion detected

and the light sensor is stuck on 0 “LUX”

any ideas?

even if someone can point me in the right direction to finding out… it would be a great help