80 Gallon 7.5hp here. It’s in the basement…directly below my room…hah
I’m not sure how yours is setup but mine is wired into my garage, basement and a couple other locations. At each location is two lighted switches: Green/On/On and Red/Stop/Running correlating to Switch Color/Push Action/Light action. It’s wired up via a latching relay (on/off) along with a contactor, pressure sensor, etc etc.
What I actually needed was two momentary contacts (on/off) and two inputs (ON/RUN - technically just ON but I got pins so why not?)
For the callback I just write low/delay/high to the appropriate relay. For the button function I check if the inputs are different then a stored variable
if (digitalRead(COMP_RUN) != compRun) {
compRun = digitalRead(COMP_RUN);
and then parse appropriate action to publish mqttClient
I’ve been programming for many years but never worked with Arduino before. Your code was able to help me write that up in under an hour yesterday. I can post the full code and/or pictures if you want.
Two questions for you.
I was reading through your new OTA firmware. I was going to update mine. I stumbled across this: OTA Update · ESP8266 Arduino Core There appears to be a couple different methods for OTA - was there any reason you chose the Arduino method over say the Web Browser? I’ll be updating my Sonoff with your OTA firmware. When my compressor is finished I was going to add OTA, just wondering which method was best.
mqtt. I’m reading up on it because prior to the sonoff I had never used it. In my compressor build I’m using the same logic you are
mqttClient.publish(MQTT::Publish(MQTT_TOPIC"/stat", “on”).set_retain().set_qos(1));
Which is triggered when the compressor goes ON (a set of relays closes GND to a GPIO) which then sends the MQTT message.
I have yet another set of contacts which will close when the actual motor is spinning. Is it really as simple as
mqttClient.publish(MQTT::Publish(MQTT_TOPIC"/run", “on”).set_retain().set_qos(1));
Assuming my MQTT_TOPIC is “home/compressor/1” could I then use a sensor in HA with
binary_sensor:
platform: mqtt
name: "Compressor"
state_topic: "/home/compressor/1/run"
sensor_class: power
?
Thanks!