logo elektroda
logo elektroda
X
logo elektroda

Transmission of PM 2.5 and PM 10 values from the SDS011 sensor via ESP8266 to Domoticz

Maciek1008 1881 11
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19159886
    Maciek1008
    Level 10  
    Hello
    I have an ESP8266 (actually a Node MCU) and an SDS011 air quality sensor connected to it. On the ESP I have uploaded ESP Easy. In this software the sensor is implemented and thanks to this I was able to get results for the two quantities measured by the sensor without any problem, namely PM 2,5 and PM 10. The problem arises when I want to send the data to Domoticz. In ESP Easy there is the possibility to enter only one IDX of the controller. If I do this I get the measurement result in Domoticz, but only the PM 2.5 value. Can anyone advise how to send the other value to Domoticz? From what I have been able to read it is necessary to enter the appropriate code in Rules, however the one I found on another forum unfortunately does not work.
  • ADVERTISEMENT
  • #2 19159950
    Slawek K.
    Level 35  
    In Devices, add this sensor a second time, with a different IDX, and send the second value, i.e. enter PM10 in the first line of Values, instead of PM25.

    Greetings
  • ADVERTISEMENT
  • #3 19160785
    Maciek1008
    Level 10  
    Unfortunately, it does not work. To confirm the screen. The results only show up in the first of the added sensors.

    Transmission of PM 2.5 and PM 10 values from the SDS011 sensor via ESP8266 to Domoticz .
  • #4 19160863
    Slawek K.
    Level 35  
    Set a different time interval for the second one, if you have e.g. 60s for the first one then set e.g. 55s for the second one and try it.
    And one more point, PM sensors should not be polled (read) too often as they have a certain life span.

    Greetings
  • ADVERTISEMENT
  • #5 19161074
    Maciek1008
    Level 10  
    I have tried with different interval values and once it sends me data from one sensor and once from the other. I have never been able to set it to send both. The other issue is that changing the name in the row in Values doesn't do anything, i.e. typing PM 10 in place of PM 2.5 doesn't display PM 10 values in the first row, which also causes PM 2.5 values to be sent from the second sensor to Domoticz as well (as shown in the screenshot).

    Transmission of PM 2.5 and PM 10 values from the SDS011 sensor via ESP8266 to Domoticz .

    Regarding the second part of your answer, yes, I am aware of this and ultimately want to set a measurement every 30 minutes or so.
  • Helpful post
    #6 19161646
    xury
    Automation specialist
    There are several ways to solve your problem:
    Way one - using rules
    Way two - using MQTT and node red.
    Way three - change the software to Tasmot
  • #7 19161692
    Maciek1008
    Level 10  
    The rules way would probably be the best solution for me, but as I mentioned, I already tried this method with the code found on another forum, but unfortunately it doesn't work, i.e. nothing flies to Domoticz. The communication itself over MQTT to Domoticz is configured correctly, because if I select Send to Controller in ESP then the PM 2.5 value is sent correctly. On the screengrab the code I paste into Rules and which supposedly should work. Perhaps some good soul can take a look at it and point out a possible error? I have the IDX entered correctly of course.
    Transmission of PM 2.5 and PM 10 values from the SDS011 sensor via ESP8266 to Domoticz .
  • ADVERTISEMENT
  • #8 19162023
    xury
    Automation specialist
    I am not keen on EspEasy precisely because of the fact that something should work and doesn't want to.
    However, maybe instead of the Domoticz controller you can use MQTT for Home Assistant, and use Node-red as an intermediary.
    I highly encourage you to use nodered. Once you have mastered nodered, the world seems more beautiful :) .
  • #9 19162210
    Slawek K.
    Level 35  
    And what kind of device are you using on the Domoticz side ? If this :

    Air quality

    Then you must send nvalue and not svalue :

    /json.htm?type=command¶m=udevice&idx=IDX&nvalue=PPM
    IDX = id of your device (This number can be found in the devices tab in the column "IDX")
    PPM = CO2-concentration

    Remove the svalue together with the preceding comma, and move what you have after the svalue to the nvalue

    Greetings
  • #10 19162971
    Maciek1008
    Level 10  
    In Domoticz, following instructions found on another forum, I use Custom Sensor. To test the change you suggested in the code I created one Air Quality and entered its idx (160) in the code. Unfortunately also without the desired results. However, maybe I made an error in editing the code? Please forgive me, but I am not a programmer and my knowledge on the subject is negligible.
    Transmission of PM 2.5 and PM 10 values from the SDS011 sensor via ESP8266 to Domoticz .
  • #12 19184228
    Maciek1008
    Level 10  
    Thanks gentlemen for your help. I finally managed to upload both measurements to Domoticz. I have included the working code in rules below for posterity.

    On SDS011#PM10 to
    SendToHTTP 192.168.1.3,8082,/json.htm?type=command&param=udevice&idx=158&nvalue=0&svalue=[SDS011#PM10]
    endon

    On SDS011#PM25 to
    SendToHTTP 192.168.1.3,8082,/json.htm?type=command&param=udevice&idx=157&nvalue=0&svalue=[SDS011#PM25]
    endon

    Of course you need to enter your ip and port and idx from Domoticz

Topic summary

The discussion revolves around transmitting PM 2.5 and PM 10 values from an SDS011 air quality sensor connected to an ESP8266 (NodeMCU) using ESP Easy software to Domoticz. The user successfully retrieves PM 2.5 data but struggles to send PM 10 data due to limitations in the software, which allows only one IDX entry. Various solutions are proposed, including adding the sensor with a different IDX, adjusting polling intervals, and using rules or MQTT for data transmission. Ultimately, the user resolves the issue by implementing a specific code in the rules section to send both measurements to Domoticz, confirming the correct configuration of IDX and HTTP requests.
Summary generated by the language model.
ADVERTISEMENT