Hi everyone, i need some help.
I have a nodemcu v0.9
1 x button to the nodemcu.
1 x Sonoff switch in my hass, that have the information:
state_topic: “/troom1/relay/state”
command_topic: “/troom1/gpio/12”
payload_on: “1”
payload_off: “0”
I want a code, so when i press the button that is attach to my nodemcu on: D1 and GND
I need to send payload 1 for turning my sonoff on, and send payload 0 for turning my sonoff off.
These configuration is close:
Thanks to user @fabaff on the Gitter chat I think I’m getting a little closer.
His original sketch-
[code]/*
Basic ESP8266 MQTT example NodeMCU ESP8266-12E development board
*/
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
int inputPins[] = { 1, 3, 12, 13, 14, 15 };
int pinInputCount = 6;
int outputPins[] = { 0, 2, 4, 5 };
int pinOutputCount = 4;
// Update these with values suitable for your network.
const char* ssid = “…”;
const char* password = “”;
const char* mqtt_server = …
Hi guys,
this is more an Arduino version, but I am sure you can help me.
I need a phisical button that switch on the led if pressed, and switch off when not.
With Home Assistant I have a switch button
Everything is working fine (I am not a programmer so I probably copy too much code for simply task).
The problem is that if board go offline nothing is working, I NEED the phisical button that works even offline.
Any suggestion? Below my code.
Thank you for your time and help.
#include <MQT…
Can someone help me?
Greetings DK.
see my topic
i solve my problem with espeasy
The problem, i dont want to use the sonoff.
I have sonoff in my house.
But i want a esp8266 nodemcu module and a button to trigger mqtt commands to my sonoff.
Not vise versa.
I want the code for the trigger mqtt commands when i press the button.
my code make exactly what do you want.
i have a button, and i can controle anything what i want.
see the post.
I dont see a proper tutorial for this, could you create one please?
What code / commands i should put on my esp8266
Greeetings DK.
anarro
(Anarro)
November 6, 2017, 11:46pm
6
Hi Dk,
You can do it without HA or MQTT protocol… the Esp firmware have the posibility to send or activate another Esp pins… its very easy or simple.
Antoni.
I created the mqtt button as i want that thing inplemented.
Thansk.
1 Like