thanks
- Code: Select all | TOGGLE FULL SIZE
// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
Adafruit_MQTT_Client mqtt(&client, MQTT_SERVER, AIO_SERVERPORT, MQTT_CLIENTID, MQTT_USERNAME, MQTT_PASSWORD);
// define objects on the dasdboard to receive commands from like a toggle button or keypad
Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/boatsubscribe.deckrelay"); // on or off
Adafruit_MQTT_Subscribe onoffbutton2 = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/boatsubscribe.dockrelay"); // on or off
// redefine the toggle blocks so we can publish to them. this is in case the power is reset and the relays
// go back to an off state we can reset the toggle state on the dashboard
Adafruit_MQTT_Publish deckrelaypublish = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/boatsubscribe.deckrelay");
Adafruit_MQTT_Publish dockrelaypublish = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/boatsubscribe.dockrelay");