Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request #1

Closed
samabsalom opened this issue Nov 23, 2016 · 3 comments
Closed

Feature request #1

samabsalom opened this issue Nov 23, 2016 · 3 comments
Labels

Comments

@samabsalom
Copy link

couldn't find an alternative way to contact you.

Love all your examples. I was wondering if there was a way to add more LEDs to the same file? I have tried altering your files but to no avail

any help you can give would be appreciated
thanks
Sam

@smrtnt
Copy link
Owner

smrtnt commented Nov 24, 2016

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

@samabsalom
Copy link
Author

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

@smrtnt
Copy link
Owner

smrtnt commented Dec 2, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants