Controller developers news for 2.0.x
-
This post describes changes for controller (and plugin) developers for supporting 2.0.x.
The serial protocol is identical to 1.5.x. But a few more sensor and variable types has been added.
New Sensor Types
- S_INFO (36) - LCD text device / Simple information device on controller, uses V_TEXT
- S_GAS (37) - Gas meter, uses V_FLOW, V_VOLUME
- S_GPS (38) - GPS Sensor, uses V_POSITION
- S_WATER_QUALITY (39) - Water quality sensor, uses V_TEMP, V_PH, V_ORP, V_EC, V_STATUS
New Variable Types
- V_TEXT (47) - For S_INFO. Text message to display on LCD or controller device
- V_CUSTOM (48) - Custom messages used for controller/inter node specific commands, preferably using S_CUSTOM device type.
- V_POSITION (49) - GPS position and altitude. Payload: latitude;longitude;altitude(m). E.g. "55.722526;13.017972;18"
- V_IR_RECORD (50) - Record IR codes S_IR for playback
- V_PH (51), - For S_WATER_QUALITY, water PH
- V_ORP (52) - For S_WATER_QUALITY, water ORP : redox potential in mV
- V_EC (53) - For S_WATER_QUALITY, water electric conductivity μS/cm (microSiemens/cm)
- V_VAR (54) - For S_POWER, Reactive power: volt-ampere reactive (var)
- V_VA (55) - For S_POWER, Apparent power: volt-ampere (VA)
- V_POWER_FACTOR (56) - For S_POWER, Ratio of real power to apparent power: floating point value in the range [-1,..,1]
MQTT
We had to drop the MQTT-gateway-server example as it was utterly un-maintained. Instead we introduce a new MQTT client gateway. It mimics the serial protocol, so it should be much easier to support once you handle the serial/ethernet gateway.
MY_MQTT_PUBLISH_TOPIC_PREFIX/NODE-ID/SENSOR-ID/CMD-TYPE/ACK-FLAG/SUB-TYPE
Example outgoing topic (with default prefix) :
mygateway1-out/1/2/2/0/1Example topic for sending data to your sensor network (with default prefix) :
mygateway1-in/1/2/2/0/1This also means a controller can (and should) answer the id-requests and time requests via the MQTT broker just like it is handled for the serial protocol today. Ack messages from sensors is also supported.
-
Will this be able to support OTA updates?
-
@Jason-Brunk OTA for nodes should work. It's already working since 1.5. Or do you ask for ota by mqtt? or ota in mqtt client gw? I had one esp8266 mqtt gw with arduinoOta working on it.
-
I guess I will have to try to dig up some documentation on the OTA. I am wanting to use mqtt client gateway, but the idea of being able to update my nodes OTA is very appealing.
-
Where can I report a bug?
(void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD); #ifdef MY_IP_ADDRESS WiFi.config(_ethernetGatewayIP, _gatewayIp, _subnetIp); #endifThe order should be different, otherwise the gateway will always be initated with DHCP and not with static IP
The correct code would be#ifdef MY_IP_ADDRESS WiFi.config(_ethernetGatewayIP, _gatewayIp, _subnetIp); #endif (void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD);refer to:
Wifi lib config -
Where can I report a bug?
(void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD); #ifdef MY_IP_ADDRESS WiFi.config(_ethernetGatewayIP, _gatewayIp, _subnetIp); #endifThe order should be different, otherwise the gateway will always be initated with DHCP and not with static IP
The correct code would be#ifdef MY_IP_ADDRESS WiFi.config(_ethernetGatewayIP, _gatewayIp, _subnetIp); #endif (void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD);refer to:
Wifi lib config -
Where can I report a bug?
(void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD); #ifdef MY_IP_ADDRESS WiFi.config(_ethernetGatewayIP, _gatewayIp, _subnetIp); #endifThe order should be different, otherwise the gateway will always be initated with DHCP and not with static IP
The correct code would be#ifdef MY_IP_ADDRESS WiFi.config(_ethernetGatewayIP, _gatewayIp, _subnetIp); #endif (void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD);refer to:
Wifi lib config -
I've found some typos on the serial api page.
S_DIMMER 4 Dimmable device of some kind V_STATUS (on/off), V_DIMMER (dimmer level 0-100), V_WATTV_DIMMER needs to be V_PERCENTAGE
S_HVAC 29 Thermostat/HVAC device V_HVAC_SETPOINT_HEAT, V_HVAC_SETPOINT_COLD, V_HVAC_FLOW_STATE, V_HVAC_FLOW_MODE, V_HVAC_SPEEDV_HVAC_SETPOINT_COLD needs to be V_HVAC_SETPOINT_COOL
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login