Home Assistant Community

BRUH DIY Multisensor

#601

I have similar problems, the sketch by BRUH works just fine but I have problems with the LED option in the Shawn Cory sketch, all other sensors work just fine and my sensorname is “sensornode2”.

light:
      - platform: mqtt
        name: "SN2 LED"
        state_topic: "homeassistant/light/sensornode2_sensor_led/state"
        command_topic: "homeassistant/light/sensornode2_sensor_led/set"
        brightness_command_topic: "homeassistant/light/sensornode2_sensor_led/brightness/set"
        brightness_state_topic: "homeassistant/light/sensornode2_sensor_led/brightness/state"
        rgb_command_topic: "homeassistant/light/sensornode2_sensor_led/rgb/set"
        rgb_state_topic: "homeassistant/light/sensornode2_sensor_led/rgb/state"
        brightness: true
        flash: true
        rgb: true
        optimistic: false
        qos: 0

The light is displayed but the LED just won’t turn on and I tried nearly any mqtt option?

I had also problems with the power on the node. On nodeMCU v3, do not use the Vin (this is a input), only use the 3v outputs on the device.

Hope someone has the answer to my question?

0 Likes

#602

Looking at the sketch…

Not brightness but brightness!!!

#define DEVICE_LED_BRIGHTNESS_COMMAND_TOPIC "homeassistant/light/" DEVICE_NAME "_sensor_led/brighness/set"
#define DEVICE_LED_BRIGHTNESS_STATE_TOPIC   "homeassistant/light/" DEVICE_NAME "_sensor_led/brighness/state"

It is working now!

0 Likes

#603

brighness? :face_with_monocle:

With your sketch the led even does not stay not the home assistant gui…

When I use this code the led switcher in the hass gui stays on (eventhough the led is off…

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
0 Likes

#604

What housing are using there. It looks great. Can you send a link where to get it?

0 Likes

#605

Hi. Sadly it wont’t be of any use to you I’m affraid… I bought it at a local shop in Croatia.
Here is the link:

http://www.electronic-center.hr/elektronika/elektroni/kutije-za-samogradnju/kutija-plasticna-pp42ws.html

0 Likes

#606

So, I struggled for weeks with getting intermittent NAN values from my DHT22’s on 6 different Bruh multisensors.

When I built the first one I thought it may have been a hardware issue with the nodemcu board, the DHT sensor or the power supply being used, but after building 6 of these with different brand power supplies, NodeMCU’s, DHT’s, etc. I was getting intermittent NANs on all of them at different times.

The only thing that would reliably fix it was to remove power from the nodemcu and reapply it (a reboot). After that it would tend to work for a while but the NANs would come back. Sometimes, very infrequently, it would fix itself.

Well, I think I finally nailed it. The DHT Sensor Library from Adafruit has a bug in it for all versions 1.2.0 and above. It is all over the web. For some reason it took me ages to find it, but now that I have found it, it appears to be rife. https://github.com/adafruit/DHT-sensor-library/issues/94

I didn’t want to stuff around with other libraries as I am just learning Arduino and didn’t want to introduce a possibly conflicting library as I didn’t know what the impact of that would be or how to undo it if I had issues.

The way I fixed it was to install version 1.1.1 of the library (the version previous to 1.2.0). After recompiling and redeploying the new code to all Bruh sensors, I have not had another NAN reported for a couple of weeks now.

There is a side effect though. The ComputeHeatIndex function within the DHT library doesn’t appear work properly in v1.1.1. It produces obviously incorrect heat index data. When humidity is high, heat index is low and vice versa.

I just ignore the heat index value calculated by the nodemcu, and calculate my own heat index inside of hassio using a value template.

I hope this helps someone who has/is experiencing similar frustrations to me. I almost abandoned the project because of it, but now I am stoked it is working. Wifey is not all that happy about seeing little 3D printed black boxes everywhere that flash red when she walks past them, but that is part of the fun isn’t it? Annoying the missus!

0 Likes

#607

Hi, i have built this sensor and used Bruh his code.
All works except for the light sensor. I use the temt6000 for that but i get no value at all.
I ordered two of them and both don’t give a value.

Do i have to change something to the code?
I also used the example Yaml from Bruh, but i cant find something wrong in there.

Does someone have any hints what to look for?

0 Likes

#608

check the pin you connect temt6000 to gpio on nodemcu.

0 Likes

#609

I have connected it to pin A0 like in the picture in the description. This pin is also stated in the code. There is a value set for it, that is 25.

0 Likes

#610

when you upload json to nodemcu. there is a test did you try the test to see if it works correctly?

0 Likes

#611

Jou mean the test to monitor the com port.
I did that test, and everything shows data except the light sensor shows zero.

0 Likes

#612

then probably your temt6000 broken. When finished upload and connected to wifi you can test and should show the result except the led because didn’t have on-off command yet.

0 Likes

#613

I had 2 of them and both fail to give me results.
I ordered 2 of the other types, hope that they work.

0 Likes

#614

Built one of these a few weeks ago and damn I think the wife hates it. HA! Why does she hate it? Because I’ve been spending hours learning the code. Think I’ve tore into just about every piece of this sketch except the LED part as I didn’t have one to play with. Have a batch coming and will probably fix/change a lot of that too. Reminds me of the old school days writing efficient and tight code in the DOS days.

It’s probably a little overblown but I’ve broken out the MQTT calls to each sensor to get rid of those spikes in the graphs at times, added some status changes with the internal LEDs, such as blue with no motion and red with motion, cycling LEDs for WiFi disconnects or MQTT disconnects, controllable internal LEDs, configuration files on the EEPROM, etc. Working on the HTTP status page and throwing in the WiFi AP stuff on new/reset configs. I hate hard coding stuff! Will probably see about ordering a few different sensor types to add to the config. I’ll probably drop the source code later once I get things cleaned up.

Now I just need to find some cases for them or breakdown and buy a 3D printer. Been thinking of some ideas to do an all in one with a wall power supply where I can just plug these in the wall and point the PIR, or mounting them in some 1 gang boxes with the sensors mounted in a 1 gang plate. Anyone use the BME280 sensor yet?

0 Likes

#615

I’ve also thought about the gang box route - would love to hear about your experience if you do it! I was looking at getting/making something like this AC-to-DC converter so that I could just tap into an existing power source in the wall, and in the event that I move I can just replace my sensor with a standard outlet and not have a random hole in the wall.

0 Likes

#616

I was trying to keep some costs down and labor, been thinking of a few things.

One would be to buy a 2 gang box, old work style(deep) (US here). Mounted over something like a doorway for motion. Like in a bathroom above the door, you probably wouldn’t see it unless you were looking up on the way out. Throw in one of those all in one USB all in one chargers outlets on one side and blank on the other side. The USB wire would be shown a bit but loop it back inside and attach to the NodeMCU. Other three sensors would attach to the blank side of the plate. It would be relatively easy to fish down a piece of romex to power the plug, although it would never get used but you aren’t modifying anything on the 120vac side, all of your “hackery” is on the low voltage side. But would that comply with things mixing voltages in the same box. Probably not. I guess you could mount two 1 gang boxes but then what do you do when you don’t want it there anymore? So I kinda scratched this one.

It would be awesome to get one of those little taps to 2 prong for a phone style charger and throw it all in the 1 gang box. Again does it comply with things… hmm…not sure. Or an alternative would be a decent little power supply that has two screw terminals in and 5vdc out on the other of course.

I do think the best solution to comply with things and makes things easy is to have a little enclosure snap over a small flat phone charger close to the wall. Pack the sensors in to the box and call it a day. There’s that 3D printer need again! :slight_smile: Something kind of like this. https://www.amazon.com/Matone-Generation-Assistants-Space-Saving-Solution/dp/B078W5JHJB

0 Likes

#617

I am interested in seeing your code when you get it ready. Please let us know when it is ready.

Thanks.

1 Like

#618

These look pretty good. Just need a say to throw some 12/14 gauge wire terminals on them for the input.

10Pcs HLK-PM01 AC-DC 220V to 5V Step-Down Power Supply Module Intelligent Household Switch Power Supply Module https://www.amazon.com/dp/B01B7GGL6C/ref=cm_sw_r_cp_apa_0erXAbPSNKQE3

0 Likes

#619

This evening i built the other sensor with the other node mcu. But with one of the temt6000 that didn’t work on the other node.
I don’t understand it, but now the light sensor on that node does work.
So that problem is solved.

0 Likes

#620

may be because of the power supply. I mean not enough electricity supply to all sensors. If temt6000 works on another node mcu that means temt6000 is not broken.

0 Likes