Comments (3)
Hi Sam,
It's possible! In this sketch, two white LEDs are controlled; in this one, two RGB LEDs are controlled.
If you need more LEDs, just apply the same logic (2 MQTT topics: state/command, a function to set the new state, a function to publish the new state and handle the command topic in the MQTT callback function).
Sam
from open-home-automation.
Thanks for getting back to me
here is what ive done to upscale if you're interested
https://github.com/samabsalom/nodemcu-MQTT-8ch_relay-home_assistant
Many thanks again!
Sam
from open-home-automation.
Good job!
In your sketch, you can use D1 instead of 5. You also forget to update the header introduction.
/*
MQTT Light for Home-Assistant - NodeMCU (ESP8266)
https://home-assistant.io/components/light.mqtt/
Libraries :
- ESP8266 core for Arduino : https://github.com/esp8266/Arduino
- PubSubClient : https://github.com/knolleary/pubsubclient
Sources :
- File > Examples > ES8266WiFi > WiFiClient
- File > Examples > PubSubClient > mqtt_auth
- File > Examples > PubSubClient > mqtt_esp8266
Schematic :
- https://github.com/mertenats/open-home-automation/blob/master/ha_mqtt_light/Schematic.png
- GND - LED - Resistor 220 Ohms - D1/GPIO5
Configuration (HA) :
light:
platform: mqtt
name: Office light'
state_topic: 'changeme/light1/status'
command_topic: 'changeme/light1/switch'
optimistic: false
Sam
from open-home-automation.
Related Issues (20)
- How to control many leds? HOT 1
- Controlling 4 lights HOT 2
- Add RGB LED to MultiSensor sketch HOT 1
- Add TEMT6000 Light Sensor support HOT 3
- Add SHT30 Temp/Humidity Sensor support HOT 3
- Add BME280 Digital Sensor Temperature Humidity Barometric Pressure support HOT 2
- Add DS18B20 Digital Temperature Sensor support
- Help: binary sensor door/button VS multi sensor door/button HOT 3
- Support for inexpensive (US$ 0.5) radar sensor RCWL 0516 HOT 3
- Can't compile the newest version from multisensor HOT 3
- Help with ha_mqtt_binary_sensor_ble_scanner HOT 1
- Extent amount of buttons / extent functions of buttons
- Help with ha_mqtt_sensor_dht22 HOT 1
- NFC scanner question
- 7 bytes NFC tag problem
- Use interupt pin in PIR code
- Problem flashing Arilux with ESP8285
- Multiple tags error
- Are you help me with project ha_mqtt_light please
- ha_mqtt_sensor_dht22.ino ArduinoJson 5 to ArduinoJson 6 upgrade
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from open-home-automation.