This ESP8266 device is intended as an implementation example of YAHNC lib
THUMBL-P is a device with the following sensors and actuators:
SwitchNode
aka LedBME280Node
aka Temperature, Humidity and PressureBinarySensorNode
aka Motion or PirButtonNode
aka Button for user inputGL5528Node
extendAdcNode
aka photoresistor for luminosity- Buzzer, implemented in the Homie "classic way"
HomieNode
All the sensor are published on MQTT topic and will be updated following the given RetentionVar
policies (eg. 0.8 lux absolute variation).
Buzzer can playback rtttl format melodies. These can be preset or sent in a json payload through /play
topic, eg:
-
Raw text for preset melodies
tetris
-
Json for preset or custom melodies, enriched with number of repetition and ms gap:
{ "preset": "siren", "loop-count": 3, "loop-gap": 1000 }
{ "rtttl": "The Simpsons:d=4,o=5,b=160:c.6,e6,f#6,8a6,g.6,e6,c6,8a,8f#,8f#,8f#,2g,8p,8p,8f#,8f#,8f#,8g,a#.,8c6,8c6,8c6,c6", "loop-count": 2, "loop-gap": 2000 }
It can work also without a connection: switch on led on motion detected (pir) during night (photoresistor).
The led light timeout and lux treshold can be set by HomieSetting
: lightOnMotionTimeout, lightOnMotionMaxLux
Compile and upload with PlatformIO:
pio run --target upload
It should be taken as example to explain the YAHNC (Yet Another Homie Node Collection) libs. So mainly to compare a classic HomieNode implementation (eg Buzzer) with the other Nodes (eg BME280Node
)
You can acces and modify the shared open source schematic by easyeda.com.