diff --git a/docs/protocol.md b/docs/protocol.md index 12cba59..cd6cbc4 100644 --- a/docs/protocol.md +++ b/docs/protocol.md @@ -11,6 +11,7 @@ Each message sent or received begins with a `$` (hex 24). Messages end with a c | m | 0x6d | Get mac address (of the MGM111)| | i | 0x69 | Get install code | | f | 0x66 | Get firmware version | +| d | 0x64 | Sent after holding the reset button for 5 seconds | ## Sending messages @@ -43,7 +44,7 @@ The mac address reponse bytes are in reverse order, if the device responds with The install code bytes are not swapped like the mac address payload. #### Meter join response payload -This always returns a 0x01 value even if the Vue is not in range of the meter. +Seems to return 0x01 even if the Vue is not in range of the meter and seems to return 0x00 before ever being provisioned with the meter. At the least, `1` is good and `0` is bad. #### Meter reading response payload The meter response payload has its own page [protocol-meter-reading.md](protocol-meter-reading.md) diff --git a/src/emporia_vue_utility.h b/src/emporia_vue_utility.h index 60f3889..9f5a104 100644 --- a/src/emporia_vue_utility.h +++ b/src/emporia_vue_utility.h @@ -25,7 +25,7 @@ // 10 to 30 seconds, so "5" is usually fine. // You might try setting this to "1" to see if your meter has // new values more often -#define METER_READING_INTERVAL 5 +#define METER_READING_INTERVAL 30 // How often to attempt to re-join the meter when it hasn't // been returning readings @@ -86,7 +86,7 @@ class EmporiaVueUtility : public Component, public UARTDevice { uint16_t import_wh; // Payload Bytes 7 to 8 byte unknown9[8]; // Payload Bytes 9 to 16 uint16_t export_wh; // Payload Bytes 17 to 18 - byte unknown19[21]; // Payload Bytes 19 to 38 + byte unknown19[21]; // Payload Bytes 19 to 39 uint32_t watts; // Payload Bytes 40 to 43 : Starts with 0x2A, only use the last 24 bits. } __attribute__((packed)); @@ -495,6 +495,10 @@ class EmporiaVueUtility : public Component, public UARTDevice { void handle_resp_meter_join() { ESP_LOGD(TAG, "Got meter join response"); + // Reusing Ver struct because both have a single byte payload value. + struct Ver *ver; + ver = &input_buffer.ver; + ESP_LOGI(TAG, "Join response value: %d", ver->value); } int handle_resp_mac_address() {