BRUH DIY Multisensor


#629

Got a few of these boards set up fine accross my house, but I’ve tried adding an aditional one with just a PIR sensor.

After using the exact same code, hardware and config.yaml(obviously changing the MQTT topics and unique bits) A board I’ve deployed is not showing the PIR state at all. It doesnt say either standby/motion detected its just blank. The MQTT topic for the board is fine since I have a reed switch on the same board which is displaying the state correctly.

Anyone else suddenly having PIR function not working as expected on new board flashes? I’ve tried a couple of different PIR modules, and tried swapping the pins around in the code just in case the node’s board was defected.

The only thing I can think is either homeassistant is not liking PIR anymore (although my other PIR sensors are working fine) or something has updated in the arduino library prior to flashing the board that it doesnt like?

Any ideas? I will post my code tonight when I’m back home if anyone can help. Thanks.


#630

sounds strange…
Have you tried an mqtt monitor, like MQTT.fx or MQTT Lens ?
It would show the mqtt messages coming out of the esp board …


#631

Or you could try to use the serial monitor in the ArduinoIDE to see if you are getting any response from the motion sensor. Of course it depends on if you have debugging code built in to your sketch.


#632

I should have uploaded this a while a back but here it is. Feel free to critique/fix things as I’m still learning on the ESP8266. This was my first ESP8266 learning project that got me hooked. Cleaned up a few things and ripped off the band-aid and threw it up there for now instead of waiting to finish/fix a few things. I’ll post pics of my case I used later this evening as I have one last thing to fix on it.


#633

Thanks - I ended up completely starting fresh with my flashing and writing the code, ended up working so must have typed something slightly incorrect the first time.

Will defo use MQTT.fx in the future though - very helpful.


#634

My redneck’d gutted Boxee Box turned into a sensor node. Little rough in some spots and need to figure out how to color the inside of the DHT22 without tearing it up, already had to unsolder the headers on the DHT22 and light resistor. But all in all it works and sits on my media center shooting the PIR down the hallway to tie into a Nodered flow with another motion sensor for dim lights for stumbling around the house after the alarm is armed and the sun is still down.

Have a few notifications/statuses on the LED, I put a second LED up top but didn’t tie it in yet. I did reuse the power button on the Boxee Box and tied it into a MQTT topic, haven’t done anything with it yet though other than being on the dashboard.


#635

Hello folks!

I see a variety of comments on the importance of good (‘stabilized’?) input voltage.

I am considering using a bare AC/DC convert like this in my sensor module.

How can I look for one that will provide a clean output?
Are there search terms or something in reviews I can keep an eye out for?


#636

I have used a multitude of devices to power my NodeMCU sensor. All just random phone chargers, like old ones. The device doesn’t pull much power and for the most part is stepping down the 5VDC to 3.3 VDC for the ESP and other sensors. The PIR sensor is using the 5VDC line though. I do remember some folks powering their nodeMCU through the VIN/GND pins with 12VDC and it would step it down but then you would need to figure out another power source to match your PIR or if it could take 12VDC.


#637

Constant reboot

I have got the multisensors built, and have had various config problems along the way, and i eventually find the issue. however this time i am stumped. Basically I can get 1 sensor working perfectly apart from the LED. but my problem is that as soon as i connect a second sensor to power they both start to reboot until i disconnect 1. I have read about these rebooting randomly, but these just reboot every 5 seconds.
Not sure if i have posted in the right place, but hopefully someone will get me looking in the right place.

Thanks in advance
Si


#638

First thing that comes to mind is the power supply.
Have you tried with different supplies ?


#639

Which board manager of esp8266 are you using? 2.3 or 2.4.x? If you are using 2.4.x rollback to 2.3 as 2.4.x has had some memory leak issues.


#640

thanks for replying, had already tried power supplies but thought i would try again,. just tried a pair of brand new Samsung phone chargers with 2.0 amp output. also tried connecting both to 2 different laptops and still they reboot. So have rolled back to 2.3 from 2.4.1 on board manager and still the same result. I think it must be something in my configuration. also i cannot get the LED’s to switch on, which may be related. I can control both of the switches from the front end of HASSIO so don’t think they are the problem.

So here is the 1st part of the sketch for a sensor. i have not changed anything else from the original by Bruh, followed by my YAML file. If someone could take a look it would be really appreciated

Thanks
Si

#include <ESP8266WiFi.h>
#include <DHT.h>
#include <PubSubClient.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <ArduinoJson.h>



/************ WIFI and MQTT INFORMATION (CHANGE THESE FOR YOUR SETUP) ******************/
#define wifi_ssid "VMxxxxxx" //type your WIFI information inside the quotes
#define wifi_password "xxxxxxxxx"
#define mqtt_server "192.168.x.x"
#define mqtt_user "xxxxx" 
#define mqtt_password "xxx"
#define mqtt_port 1883



/************* MQTT TOPICS (change these topics as you wish)  **************************/
#define light_state_topic "House/Backroom"
#define light_set_topic "House/Backroom/set"

const char* on_cmd = "ON";
const char* off_cmd = "OFF";



/**************************** FOR OTA **************************************************/
#define SENSORNAME "xxxxxxxxx"
#define OTApassword "xxxxx" // change this to whatever password you want to use when you upload OTA
int OTAport = 8266;

And my Configuration.yaml

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

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

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

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

switch:  
  - platform: mqtt
    icon: mdi:radiator
    name: "Backroom"
    command_topic: "cmnd/backroom/power"
    state_topic: "stat/backroom/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true
    

  - platform: mqtt
    icon: mdi:radiator
    name: "Lounge"
    command_topic: "cmnd/lounge/power"
    state_topic: "stat/lounge/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

climate:
  - platform: generic_thermostat
    entities: sensor.backroom
    name: Backroom
    heater: switch.backroomrad1
    target_sensor: sensor.backroom_temperature
    target_temp: 28
    Tolerance : 1
    min_cycle_duration:
      seconds: 10
    keep_alive:
      minutes: 3

  - platform: generic_thermostat
    entities: sensor.lounge
    name: Lounge
    heater: switch.lounge
    target_sensor: sensor.lounge_temperature
    target_temp: 28
    Tolerance : 1
    min_cycle_duration:
      seconds: 10
    keep_alive:
      minutes: 3


group:   
  Backroom_card:  
    name: Backroom  
    entities:  
      - sensor.Backroom_temperature  
      - sensor.Backroom_humidity  
      - sensor.Backroom_ldr  
      - sensor.Backroom_pir  
      - light.Backroom_led

  Lounge_card:  
    name: Lounge  
    entities:  
      - sensor.Lounge_temperature  
      - sensor.Lounge_humidity  
      - sensor.Lounge_ldr  
      - sensor.lounge_pir  
      - light.Lounge_led

#641

Aren’t MQTT topics case sensitive ?
Wouldn’t cause the board to reboot tho…


#642

Thanks. yes your right about case sensitivity, i have put that right and got the LED working, but the colours are all over the place. I will investigate further.
As for the rebooting, i seem to have cured it. I don’t know what was causing it but i built a new sensor and replaced 1 of the 2 and now quite stisfied
So just the LED to sort out, although i can’t really see what purpose it serves but as its there i want it to work.
It is my understanding that ground is the longer leg, but i cant get any life out of it unless i use the other middle leg as ground, but as i said the colours appear to be all mixed up.


#643

For those that have printed the Bruh case and use a lolin esp8266 and found that it does not fit. I am working on a new design that makes the outer diameter bigger so the chip will fit but the internal cuts outs are the same, drop me a pm for the .stl


#644

I am trying to use this as a light sensor for my screens.
The problem is that the lux range stops at 970. i need more range to make a difference noticeable between direct sunlight and bright daylight.


#645

You might try a BH1750 or TSL2561 sensor then.


#646

Thanks for the tip. Think i will try the BH1750.
But then i will have to change the code i think?
Or would this work just fine with Bruh’s code.


#647

Yes it would have to be changed as the sensor works on the i2c bus utilizing 2 GPIO pins. The library for these chips are somewhat simple but offer a larger range and high precision you are looking for.


#648

Hi,

I just received first pieces from Amazon.

This weekend I will start testing hw and sw.

In the meantime I was thinking…did anyone tried to add BLE functionality for better room tracking?