Achronite / mqtt-energenie-ener314rt

MQTT interface for Energenie ENER314-RT add-on board for the Raspberry Pi, designed for use by Home Assistant.
MIT License
13 stars 5 forks source link

Device Type 18 #56

Closed DrOwl closed 5 months ago

DrOwl commented 8 months ago

Hi,

I have a Thermostat MIHO069.

Below are some logs from it hope the below can help generate a device file for it... Is there any other logging / debugging I can do to get data about it?

` mqtt-ener314rt info discovery found 14 devices mqtt-ener314rt info discovery discovered: {"mfrId":4,"productId":18,"deviceId":11111111,"control":2,"product":"Thermostat","joined":0} mqtt-ener314rt ERR! discovery skipped for device 11111111 - unknown device type 'devices/18.json' missing

mqtt-ener314rt http monitor received: {"deviceId":11111111,"mfrId":4,"productId":18,"timestamp":1700581965,"WAKEUP":0,"cmd":"monitor"} mqtt-ener314rt http monitor received: {"deviceId":11111111,"mfrId":4,"productId":18,"timestamp":1700581967,"BATTERY_LEVEL":2.562988,"THERMOSTAT_MODE":0,"cmd":"monitor"} mqtt-ener314rt http monitor received: {"deviceId":11111111,"mfrId":4,"productId":18,"timestamp":1700582018,"THERMOSTAT_MODE":0,"cmd":"monitor"} mqtt-ener314rt http monitor received: {"deviceId":11111111,"mfrId":4,"productId":18,"timestamp":1700582019,"THERMOSTAT_MODE":0,"cmd":"monitor"} mqtt-ener314rt http monitor received: {"deviceId":11111111,"mfrId":4,"productId":18,"timestamp":1700582615,"REL_HUMIDITY":59,"THERMOSTAT_MODE":0,"cmd":"monitor"} (2966 results) [945/24484] mqtt-ener314rt http monitor received: {"deviceId":11111111,"mfrId":4,"productId":18,"timestamp":1700582667,"REL_HUMIDITY":59,"THERMOSTAT_MODE":0,"cmd":"monitor"}

{"deviceId":11111111,"mfrId":4,"productId":18,,"TEMPERATURE":19.5,"REL_HUMIDITY":54,"THERMOSTAT_MODE":0,"cmd":"monitor"} {"deviceId":11111111,"mfrId":4,"productId":18,,"TEMPERATURE":19.5,"REL_HUMIDITY":55,"THERMOSTAT_MODE":0,"cmd":"monitor"} {"deviceId":11111111,"mfrId":4,"productId":18,,"TEMPERATURE":19,"THERMOSTAT_MODE":0,"cmd":"monitor"} {"deviceId":11111111,"mfrId":4,"productId":18,,"THERMOSTAT_MODE":0,"cmd":"monitor"} {"deviceId":11111111,"mfrId":4,"productId":18,,"WAKEUP":0,"cmd":"monitor"} {"deviceId":11111111,"mfrId":4,"productId":18,,"TEMPERATURE":19.25,"REL_HUMIDITY":56,"BATTERY_LEVEL":2.564941,"THERMOSTAT_MODE":0,"cmd":"monitor"} {"deviceId":11111111,"mfrId":4,"productId":18,,"TEMPERATURE":19.25,"THERMOSTAT_MODE":0,"cmd":"monitor"} {"deviceId":11111111,"mfrId":4,"productId":18,,"TEMPERATURE":19.375,"REL_HUMIDITY":55,"BATTERY_LEVEL":2.565918,"THERMOSTAT_MODE":0,"cmd":"monitor"} {"deviceId":11111111,"mfrId":4,"productId":18,,"REL_HUMIDITY":61,"THERMOSTAT_MODE":0,"cmd":"monitor"} {"deviceId":11111111,"mfrId":4,"productId":18,,"BATTERY_LEVEL":2.562988,"THERMOSTAT_MODE":0,"cmd":"monitor"}

`

sgulati-hub commented 7 months ago

@DrOwl @sgulati-hub I have a couple of question for you to test with your gateways.

  1. Can you please test manually switching the thermostat on/off (using the power button on the thermostat) and let me know if the app/gateways deals with this correctly and doesn't override the thermostat mode?

If it does deal with it OK, then it must have a way of retrieving the telemetry data without changing the thermostst state....

  1. Can you please do the following: a) remove the batteries from the thermostat b) start capture of a trace from this code c) issue a thermostat mode change via the MiHome app (to see if this code captures any commands issued by the gateway) d) wait a couple of minutes, then stop the trace capture

Hopefully with a combination of both of these we can get to the bottom of how the MiHome app works with the thermostat which can then be replicated here.

Here are my observations: 1) Manually switching Thermostat ON/OFF (power button on the Thermostat) updates the status on the App within approximately 30 seconds i.e. App/Gateway does not override instead updates the status correctly on App and on web. 2) No communication to (or from) Thermostat found in the trace after removing the batteries of the thermostat. It seems code trace is not capturing any communication sent from the gateway to any device.

DrOwl commented 7 months ago

@Achronite I am seeing the same results as @sgulati-hub

I am also seeing lots of failed / error messages, they seem to me length related! Not sure why this is happening, ether code related or i have broken requirements somehow!

*****HRF_readfifo_burst_cbp() len=29, data:28:4:18:159:3:98:189:122:21:177:119:239:240:188:36:104:209:221:123:239:107:93:5:27:246:58:56:246:28:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_decode() len=28, decoded data:28:4:18:159:3:0:4:135:112:130:0:0:113:130:255:247:118:9:241:102:34:50:0:115:1:1:0:102:142: crc:11461, crca:26254, deviceId=1159 - CRC FAILED

mqtt-ener314rt verb < energenie/2/1303/switch/state: ON                                                                                                                                                            
**HRF_readfifo_burst_cbp() len=11, data:10:4:18:89:185:73:149:158:6:16:167:90:33:204:204:219:74:184:101:136:44:70:60:230:208:240:80:139:115:57:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
0:0:0:                                                                                                                                                                                                             
@Non-OT message, openThings_decode() returned 0    

HRF_readfifo_burst_cbp() len=11, data:10:4:18:31:85:3:89:93:136:88:170:105:33:204:204:219:74:184:101:249:44:97:0:250:0:74:103:96:88:255:221:149:232:213:163:156:221:67:17:205:104:249:155:238:105:253:143:211:113:7
8:107:123:207:246:63:231:219:44:181:105:34:0:0:0:0:0:0:                                                                                                                                                            
@Non-OT message, openThings_decode() returned 0   

******HRF_readfifo_burst_cbp() len=11, data:10:4:18:47:104:99:218:9:13:95:192:36:248:211:82:4:228:202:104:128:45:220:24:10:210:41:5:148:64:114:28:5:243:28:237:85:168:204:34:145:168:93:174:123:41:141:166:98:255:13:103:49:157:196:122:125:57:247:242:213:249:0:0:0:0:0:0:
@Non-OT message, openThings_decode() returned 0

****HRF_readfifo_burst_cbp() len=11, data:10:4:18:80:15:186:199:248:54:148:65:252:144:63:112:234:214:191:217:179:89:211:136:17:248:206:168:155:89:55:58:127:235:222:192:0:125:227:247:249:12:191:240:225:144:204:154:222:121:248:189:132:252:234:156:247:189:255:255:249:247:0:0:0:0:0:0:
@Non-OT message, openThings_decode() returned 0
Achronite commented 6 months ago

I am also seeing lots of failed / error messages, they seem to me length related!

The whole message is what is returned via SPI from the buffer on the ENER314-RT.

I've manually decoded the first message (which says it is actually length 11) and the 11 bytes are correctly formatted to OpenThings specification, but it contains no record data! i.e the first record parameter code is 0, hence why it returns 0 records. The CRC check passes ok too. Very weird!

I'm guessing it's a bug on the energenie side; all of the failed messages are coming from a thermostat (18 at position 3).

Achronite commented 6 months ago

@DrOwl @sgulati-hub I have hopefully disabled the radio address filtering in the develop branch. This (for me) has added the ability of logging any commands issued from my production environment on my test one where previously these had not been shown. So hopefully we will now see any commands being issued by the MiHome gateway. Can you please download to test point 2 again please (you will need this and the energenie-ener314rt modules for this to work).

There is a slight side-effect in that you may also see radio messages that are not from energenie devices being logged as errors (-2) in the logfile; but these are not to be worried about.

sgulati-hub commented 6 months ago

@Achronite, I am now using latest code from develop branch but still not getting any communication sent from gateway. However, I can see following in the logs:

@Non-OT message, openThings_decode() returned -2

Not sure whether I have missed some configuration settings.

Achronite commented 6 months ago

but still not getting any communication sent from gateway

Are you sure? It seems strange that it is picking up other 'stray' FSK radio data but nothing from the gateway? Is there any correlation between issuing gateway commands and the -2 appearing in the logfile? Can you paste a few of these messages (after enabling FULLTRACE )?

EDIT: Sometimes mine misses the radio message for the thermostat from production. Maybe try one of your monitor sockets or somethings after unplugging? They are much easier to track as the commands are not cached.

Not sure whether I have missed some configuration settings.

I added another optional field to the config.json file in this version (number of cached retries); but this shouldn't affect the results.

Achronite commented 6 months ago

Doh! I've just realised that my steps in 2 above WILL NOT WORK, as the gateway only sends command when it hears a WAKEUP from the thermostat. 🤦

So... please leave the thermostat batteries in for testing; maybe testing an unplugged 'monitor' socket would be easier to prove we are receiving messages from the gateway first; and then try and capture what the gateway sends in response to WAKEUP commands to get the extra data (which it only does periodically).

EDIT: For reference you should see something like this in the logs:

openThings_receive(): Returning: {"deviceId":1468762,"mfrId":4,"productId":18,"timestamp":1704469013,"WAKEUP":0,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":1468762,"mfrId":4,"productId":18,"timestamp":1704469013,"WAKEUP":0,"command":0,"retries":0,"cmd":"monitor"}
@openThings_receive(): Returning: 

And then straight after you should see a command from the gateway (this one here is from my production rpi). It shows that I get the telemetry using a THERMOSTAT_MODE command, you can tell it is a command because it only has 1 named (uppercase) parameter in the message :

{"deviceId":1468762,"mfrId":4,"productId":18,"timestamp":1704469014,"THERMOSTAT_MODE":1,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":1468762,"mfrId":4,"productId":18,"timestamp":1704469014,"THERMOSTAT_MODE":1,"command":0,"retries":0,"cmd":"monitor"}
sgulati-hub commented 6 months ago

This is what I got in the logs

*HRF_readfifo_burst_cbp() len=13, data:12:4:18:180:34:143:40:102:141:50:94:10:192:204:204:156:74:184:102:31:44:183:57:142:196:23:109:140:36:82:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@rlen=0
openThings_receive(): hdr: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704488013
openThings_receive(): rec:0 {"name":"WAKEUP","id":89,"type":1,"str":"","int":0,"float":767.000000}
openThings_receive: Returning: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704488013,"WAKEUP":0,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704488013,"WAKEUP":0,"command":0,"retries":0,"cmd":"monitor"}
*HRF_readfifo_burst_cbp() len=24, data:23:4:18:126:145:127:66:227:43:136:136:171:151:240:155:10:208:249:20:187:245:114:227:180:74:15:159:35:81:0:152:251:24:142:51:41:123:112:84:180:177:39:34:115:19:137:42:194:4:155:38:233:77:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704488014
openThings_receive(): rec:0 {"name":"REL_HUMIDITY","id":104,"type":1,"str":"","int":89,"float":89.000000}
openThings_receive(): rec:1 {"name":"THERMOSTAT_MODE","id":42,"type":1,"str":"","int":1,"float":1.000000}
openThings_receive(): rec:2 {"name":"TARGET_TEMP","id":75,"type":2,"str":"","int":256,"float":16.000000}
openThings_receive(): rec:3 {"name":"SWITCH_STATE","id":115,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive: Returning: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704488014,"REL_HUMIDITY":89,"THERMOSTAT_MODE":1,"TARGET_TEMP":16.000000,"SWITCH_STATE":0,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704488014,"REL_HUMIDITY":89,"THERMOSTAT_MODE":1,"TARGET_TEMP":16,"SWITCH_STATE":0,"command":0,"retries":0,"cmd":"monitor"}
*HRF_readfifo_burst_cbp() len=29, data:28:4:2:169:132:244:190:101:219:227:153:216:83:33:249:44:118:26:243:174:128:214:160:49:225:125:16:233:73:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704488015
openThings_receive(): rec:0 {"name":"REAL_POWER","id":112,"type":1,"str":"","int":12,"float":12.000000}
openThings_receive(): rec:1 {"name":"REACTIVE_POWER","id":113,"type":1,"str":"","int":-1,"float":-1.000000}
openThings_receive(): rec:2 {"name":"VOLTAGE","id":118,"type":1,"str":"","int":234,"float":234.000000}
openThings_receive(): rec:3 {"name":"FREQUENCY","id":102,"type":2,"str":"","int":12774,"float":49.898438}
openThings_receive(): rec:4 {"name":"SWITCH_STATE","id":115,"type":1,"str":"","int":1,"float":1.000000}
openThings_receive: Returning: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704488015,"REAL_POWER":12,"REACTIVE_POWER":-1,"VOLTAGE":234,"FREQUENCY":49.898438,"SWITCH_STATE":1}
mqtt-ener314rt http monitor received: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704488015,"REAL_POWER":12,"REACTIVE_POWER":-1,"VOLTAGE":234,"FREQUENCY":49.898438,"SWITCH_STATE":1,"cmd":"monitor"}
*HRF_readfifo_burst_cbp() len=24, data:23:4:18:18:104:139:194:247:188:99:248:21:139:200:0:68:94:161:212:117:175:147:141:51:185:77:12:57:156:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704488016
openThings_receive(): rec:0 {"name":"REL_HUMIDITY","id":104,"type":1,"str":"","int":89,"float":89.000000}
openThings_receive(): rec:1 {"name":"THERMOSTAT_MODE","id":42,"type":1,"str":"","int":1,"float":1.000000}
openThings_receive(): rec:2 {"name":"TARGET_TEMP","id":75,"type":2,"str":"","int":256,"float":16.000000}
openThings_receive(): rec:3 {"name":"SWITCH_STATE","id":115,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive: Returning: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704488016,"REL_HUMIDITY":89,"THERMOSTAT_MODE":1,"TARGET_TEMP":16.000000,"SWITCH_STATE":0,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704488016,"REL_HUMIDITY":89,"THERMOSTAT_MODE":1,"TARGET_TEMP":16,"SWITCH_STATE":0,"command":0,"retries":0,"cmd":"monitor"}
************HRF_readfifo_burst_cbp() len=23, data:22:4:5:201:140:251:132:170:68:142:237:49:33:204:204:156:74:184:102:124:44:14:199:109:211:200:171:25:168:104:102:104:19:128:226:64:101:76:103:252:210:216:9:191:16:71:194:72:197:171:254:134:204:209:232:133:88:16:177:111:158:192:218:216:223:71:0:
@openThings_receive(): hdr: {"deviceId":21065,"mfrId":4,"productId":5,"timestamp":1704488023
openThings_receive(): rec:0 {"name":"APPARENT_POWER","id":80,"type":1,"str":"","int":769,"float":769.000000}
openThings_receive(): rec:1 {"name":"VOLTAGE","id":118,"type":2,"str":"","int":1038,"float":4.054688}
openThings_receive(): rec:2 {"name":"CURRENT","id":105,"type":2,"str":"","int":702,"float":2.742188}
Achronite commented 6 months ago

This is what I got in the logs

It doesn't look like it captured the gateway command that time. This can happen due to the minute timing issues (I've seen it too on my setup). Can you monitor a bit longer.... what I'm looking for is the message that occurs between the WAKEUP and the 4 record result from the thermostat.

@sgulati-hub Do you have a smart plug+ (MIHO005)? If you do it would be good to confirm that the rpi shows the on/off command being sent from the gateway after unplugging the MIHO005 first.

sgulati-hub commented 6 months ago

@Achronite It seems trace is not capturing commands issued by the gateway. I have now attached the logs from longer period which definitely covers the time starting from the command issued on the App to the time when change took affect on the thermostat and bit beyond. Not sure what is meant by "minute timing issues" but have verified that time on rpi is properly synced.

*************HRF_readfifo_burst_cbp() len=14, data:13:4:12:51:242:153:73:170:28:61:74:247:29:150:48:199:65:244:184:227:246:72:102:172:36:209:89:35:173:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":5523,"mfrId":4,"productId":12,"timestamp":1704553085
openThings_receive(): rec:0 {"name":"MOTION_DETECTOR","id":109,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive: Returning: {"deviceId":5523,"mfrId":4,"productId":12,"timestamp":1704553085,"MOTION_DETECTOR":0}
mqtt-ener314rt http monitor received: {"deviceId":5523,"mfrId":4,"productId":12,"timestamp":1704553085,"MOTION_DETECTOR":0,"cmd":"monitor"}
HRF_readfifo_burst_cbp() len=15, data:14:4:18:10:131:19:68:104:131:132:112:212:159:153:11:84:72:10:166:202:57:243:60:129:49:47:39:24:188:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553086
openThings_receive(): rec:0 {"name":"TARGET_TEMP","id":75,"type":2,"str":"","int":272,"float":17.000000}
openThings_receive: Returning: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553086,"TARGET_TEMP":17.000000,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553086,"TARGET_TEMP":17,"command":0,"retries":0,"cmd":"monitor"}
***HRF_readfifo_burst_cbp() len=18, data:17:4:18:154:76:184:214:240:162:201:246:131:250:49:214:202:43:193:24:94:18:181:29:177:53:197:190:23:185:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553088
openThings_receive(): rec:0 {"name":"TEMPERATURE","id":116,"type":2,"str":"","int":264,"float":16.500000}
openThings_receive(): rec:1 {"name":"THERMOSTAT_MODE","id":42,"type":1,"str":"","int":1,"float":1.000000}
openThings_receive: Returning: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553088,"TEMPERATURE":16.500000,"THERMOSTAT_MODE":1,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553088,"TEMPERATURE":16.5,"THERMOSTAT_MODE":1,"command":0,"retries":0,"cmd":"monitor"}
HRF_readfifo_burst_cbp() len=29, data:28:4:2:133:53:13:66:250:111:17:122:243:88:206:92:249:33:119:207:103:152:143:74:88:68:226:237:36:254:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553088
openThings_receive(): rec:0 {"name":"REAL_POWER","id":112,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:1 {"name":"REACTIVE_POWER","id":113,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:2 {"name":"VOLTAGE","id":118,"type":1,"str":"","int":233,"float":233.000000}
openThings_receive(): rec:3 {"name":"FREQUENCY","id":102,"type":2,"str":"","int":12813,"float":50.050781}
openThings_receive(): rec:4 {"name":"SWITCH_STATE","id":115,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive: Returning: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553088,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":233,"FREQUENCY":50.050781,"SWITCH_STATE":0}
mqtt-ener314rt http monitor received: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553088,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":233,"FREQUENCY":50.050781,"SWITCH_STATE":0,"cmd":"monitor"}
*******************HRF_readfifo_burst_cbp() len=29, data:28:4:2:121:168:8:233:248:54:72:227:84:79:161:66:144:228:250:151:167:118:212:207:155:82:124:136:149:13:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553098
openThings_receive(): rec:0 {"name":"REAL_POWER","id":112,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:1 {"name":"REACTIVE_POWER","id":113,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:2 {"name":"VOLTAGE","id":118,"type":1,"str":"","int":233,"float":233.000000}
openThings_receive(): rec:3 {"name":"FREQUENCY","id":102,"type":2,"str":"","int":12800,"float":50.000000}
openThings_receive(): rec:4 {"name":"SWITCH_STATE","id":115,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive: Returning: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553098,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":233,"FREQUENCY":50.000000,"SWITCH_STATE":0}
mqtt-ener314rt http monitor received: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553098,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":233,"FREQUENCY":50,"SWITCH_STATE":0,"cmd":"monitor"}
*******************HRF_readfifo_burst_cbp() len=29, data:28:4:2:153:188:143:207:50:86:195:136:112:68:110:57:209:119:171:145:148:130:196:26:203:109:45:110:169:212:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553108
openThings_receive(): rec:0 {"name":"REAL_POWER","id":112,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:1 {"name":"REACTIVE_POWER","id":113,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:2 {"name":"VOLTAGE","id":118,"type":1,"str":"","int":233,"float":233.000000}
openThings_receive(): rec:3 {"name":"FREQUENCY","id":102,"type":2,"str":"","int":12800,"float":50.000000}
openThings_receive(): rec:4 {"name":"SWITCH_STATE","id":115,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive: Returning: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553108,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":233,"FREQUENCY":50.000000,"SWITCH_STATE":0}
mqtt-ener314rt http monitor received: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553108,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":233,"FREQUENCY":50,"SWITCH_STATE":0,"cmd":"monitor"}
*******************HRF_readfifo_burst_cbp() len=29, data:28:4:2:6:246:67:36:178:34:71:198:182:1:55:200:74:145:63:114:195:71:193:105:45:145:226:61:214:143:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553119
openThings_receive(): rec:0 {"name":"REAL_POWER","id":112,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:1 {"name":"REACTIVE_POWER","id":113,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:2 {"name":"VOLTAGE","id":118,"type":1,"str":"","int":233,"float":233.000000}
openThings_receive(): rec:3 {"name":"FREQUENCY","id":102,"type":2,"str":"","int":12800,"float":50.000000}
openThings_receive(): rec:4 {"name":"SWITCH_STATE","id":115,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive: Returning: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553119,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":233,"FREQUENCY":50.000000,"SWITCH_STATE":0}
mqtt-ener314rt http monitor received: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553119,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":233,"FREQUENCY":50,"SWITCH_STATE":0,"cmd":"monitor"}
*******************HRF_readfifo_burst_cbp() len=29, data:28:4:2:96:16:63:239:147:2:142:150:241:153:97:172:211:150:45:6:47:45:12:195:14:72:71:27:236:13:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553129
openThings_receive(): rec:0 {"name":"REAL_POWER","id":112,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:1 {"name":"REACTIVE_POWER","id":113,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:2 {"name":"VOLTAGE","id":118,"type":1,"str":"","int":233,"float":233.000000}
openThings_receive(): rec:3 {"name":"FREQUENCY","id":102,"type":2,"str":"","int":12800,"float":50.000000}
openThings_receive(): rec:4 {"name":"SWITCH_STATE","id":115,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive: Returning: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553129,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":233,"FREQUENCY":50.000000,"SWITCH_STATE":0}
mqtt-ener314rt http monitor received: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553129,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":233,"FREQUENCY":50,"SWITCH_STATE":0,"cmd":"monitor"}
*******************HRF_readfifo_burst_cbp() len=29, data:28:4:2:112:211:233:87:188:254:241:37:33:210:140:255:84:32:30:91:13:77:247:126:58:126:192:221:218:153:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553139
openThings_receive(): rec:0 {"name":"REAL_POWER","id":112,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:1 {"name":"REACTIVE_POWER","id":113,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:2 {"name":"VOLTAGE","id":118,"type":1,"str":"","int":232,"float":232.000000}
openThings_receive(): rec:3 {"name":"FREQUENCY","id":102,"type":2,"str":"","int":12800,"float":50.000000}
openThings_receive(): rec:4 {"name":"SWITCH_STATE","id":115,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive: Returning: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553139,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":232,"FREQUENCY":50.000000,"SWITCH_STATE":0}
mqtt-ener314rt http monitor received: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553139,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":232,"FREQUENCY":50,"SWITCH_STATE":0,"cmd":"monitor"}
******************HRF_readfifo_burst_cbp() len=29, data:28:4:2:232:223:84:123:64:153:152:224:132:132:112:152:53:234:238:41:90:192:247:110:247:196:30:74:137:38:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553148
openThings_receive(): rec:0 {"name":"REAL_POWER","id":112,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:1 {"name":"REACTIVE_POWER","id":113,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:2 {"name":"VOLTAGE","id":118,"type":1,"str":"","int":232,"float":232.000000}
openThings_receive(): rec:3 {"name":"FREQUENCY","id":102,"type":2,"str":"","int":12800,"float":50.000000}
openThings_receive(): rec:4 {"name":"SWITCH_STATE","id":115,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive: Returning: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553148,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":232,"FREQUENCY":50.000000,"SWITCH_STATE":0}
mqtt-ener314rt http monitor received: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553148,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":232,"FREQUENCY":50,"SWITCH_STATE":0,"cmd":"monitor"}
**********HRF_readfifo_burst_cbp() len=13, data:12:4:18:72:187:248:220:246:116:30:2:64:188:110:57:209:119:171:145:148:130:196:26:203:109:45:110:169:212:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@rlen=0
openThings_receive(): hdr: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553154
openThings_receive(): rec:0 {"name":"WAKEUP","id":89,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive: Returning: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553154,"WAKEUP":0,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553154,"WAKEUP":0,"command":0,"retries":0,"cmd":"monitor"}
*HRF_readfifo_burst_cbp() len=21, data:20:4:18:141:46:58:35:193:195:120:30:228:152:61:73:200:183:48:136:1:24:193:105:45:145:226:61:214:143:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553155
openThings_receive(): rec:0 {"name":"REL_HUMIDITY","id":104,"type":1,"str":"","int":85,"float":85.000000}
openThings_receive(): rec:1 {"name":"THERMOSTAT_MODE","id":42,"type":1,"str":"","int":1,"float":1.000000}
openThings_receive(): rec:2 {"name":"TARGET_TEMP","id":75,"type":2,"str":"","int":264,"float":16.500000}
openThings_receive: Returning: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553155,"REL_HUMIDITY":85,"THERMOSTAT_MODE":1,"TARGET_TEMP":16.500000,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553155,"REL_HUMIDITY":85,"THERMOSTAT_MODE":1,"TARGET_TEMP":16.5,"command":0,"retries":0,"cmd":"monitor"}
*HRF_readfifo_burst_cbp() len=21, data:20:4:18:213:226:129:116:204:215:239:205:111:91:11:246:197:227:133:99:185:191:12:195:14:72:71:27:236:13:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553156
openThings_receive(): rec:0 {"name":"REL_HUMIDITY","id":104,"type":1,"str":"","int":85,"float":85.000000}
openThings_receive(): rec:1 {"name":"THERMOSTAT_MODE","id":42,"type":1,"str":"","int":1,"float":1.000000}
openThings_receive(): rec:2 {"name":"TARGET_TEMP","id":75,"type":2,"str":"","int":264,"float":16.500000}
openThings_receive: Returning: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553156,"REL_HUMIDITY":85,"THERMOSTAT_MODE":1,"TARGET_TEMP":16.500000,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553156,"REL_HUMIDITY":85,"THERMOSTAT_MODE":1,"TARGET_TEMP":16.5,"command":0,"retries":0,"cmd":"monitor"}
HRF_readfifo_burst_cbp() len=21, data:20:4:18:114:192:129:148:219:0:6:164:138:231:206:179:180:60:35:101:186:143:247:126:58:126:192:221:218:153:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553156
openThings_receive(): rec:0 {"name":"REL_HUMIDITY","id":104,"type":1,"str":"","int":85,"float":85.000000}
openThings_receive(): rec:1 {"name":"THERMOSTAT_MODE","id":42,"type":1,"str":"","int":1,"float":1.000000}
openThings_receive(): rec:2 {"name":"TARGET_TEMP","id":75,"type":2,"str":"","int":264,"float":16.500000}
openThings_receive: Returning: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553156,"REL_HUMIDITY":85,"THERMOSTAT_MODE":1,"TARGET_TEMP":16.500000,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553156,"REL_HUMIDITY":85,"THERMOSTAT_MODE":1,"TARGET_TEMP":16.5,"command":0,"retries":0,"cmd":"monitor"}
***HRF_readfifo_burst_cbp() len=29, data:28:4:2:180:3:58:108:135:157:74:178:2:131:34:254:21:155:73:110:226:167:14:114:111:82:68:99:246:69:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553158
openThings_receive(): rec:0 {"name":"REAL_POWER","id":112,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:1 {"name":"REACTIVE_POWER","id":113,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:2 {"name":"VOLTAGE","id":118,"type":1,"str":"","int":232,"float":232.000000}
openThings_receive(): rec:3 {"name":"FREQUENCY","id":102,"type":2,"str":"","int":12800,"float":50.000000}
openThings_receive(): rec:4 {"name":"SWITCH_STATE","id":115,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive: Returning: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553158,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":232,"FREQUENCY":50.000000,"SWITCH_STATE":0}
mqtt-ener314rt http monitor received: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553158,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":232,"FREQUENCY":50,"SWITCH_STATE":0,"cmd":"monitor"}
*******************HRF_readfifo_burst_cbp() len=29, data:28:4:2:38:108:132:16:172:163:178:199:31:138:236:12:238:78:89:83:138:27:251:251:205:254:228:158:24:142:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553168
openThings_receive(): rec:0 {"name":"REAL_POWER","id":112,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:1 {"name":"REACTIVE_POWER","id":113,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive(): rec:2 {"name":"VOLTAGE","id":118,"type":1,"str":"","int":232,"float":232.000000}
openThings_receive(): rec:3 {"name":"FREQUENCY","id":102,"type":2,"str":"","int":12800,"float":50.000000}
openThings_receive(): rec:4 {"name":"SWITCH_STATE","id":115,"type":1,"str":"","int":0,"float":0.000000}
openThings_receive: Returning: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553168,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":232,"FREQUENCY":50.000000,"SWITCH_STATE":0}
mqtt-ener314rt http monitor received: {"deviceId":9560,"mfrId":4,"productId":2,"timestamp":1704553168,"REAL_POWER":0,"REACTIVE_POWER":0,"VOLTAGE":232,"FREQUENCY":50,"SWITCH_STATE":0,"cmd":"monitor"}
Achronite commented 6 months ago

@sgulati-hub I think i spot two commands in your log!

The first is a TARGET_TEMP command The second is either a set thermostat to auto, or a change in the target temperature to (16.5)

In both cases it looks like the WAKEUP was not received on the rpi:

HRF_readfifo_burst_cbp() len=15, data:14:4:18:10:131:19:68:104:131:132:112:212:159:153:11:84:72:10:166:202:57:243:60:129:49:47:39:24:188:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553086
openThings_receive(): rec:0 {"name":"TARGET_TEMP","id":75,"type":2,"str":"","int":272,"float":17.000000}
openThings_receive: Returning: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553086,"TARGET_TEMP":17.000000,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553086,"TARGET_TEMP":17,"command":0,"retries":0,"cmd":"monitor"}
***HRF_readfifo_burst_cbp() len=18, data:17:4:18:154:76:184:214:240:162:201:246:131:250:49:214:202:43:193:24:94:18:181:29:177:53:197:190:23:185:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553088
openThings_receive(): rec:0 {"name":"TEMPERATURE","id":116,"type":2,"str":"","int":264,"float":16.500000}
openThings_receive(): rec:1 {"name":"THERMOSTAT_MODE","id":42,"type":1,"str":"","int":1,"float":1.000000}
openThings_receive: Returning: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553088,"TEMPERATURE":16.500000,"THERMOSTAT_MODE":1,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":14525829,"mfrId":4,"productId":18,"timestamp":1704553088,"TEMPERATURE":16.5,"THERMOSTAT_MODE":1,"command":0,"retries":0,"cmd":"monitor"}

Where did these commands originate?

If you look at the suspected command messages, they also have additional data beyond the reported lengths; I wonder why?

Achronite commented 6 months ago

Excellent news!

OK I've now CONFIRMED that the TARGET_TEMP above is a command rather than a response to a command; so it looks like we can capture what the gateway is sending out! 😁 (If you want the technical details, a command has 0x80 added to it, but I strip it before decoding the number 203 (0xCB) in this case, back to the (response) parameter 75 (0x4B) = TARGET_TEMP.

I'm obviously going to do something about this in the (probably trace output) code, so it is a bit clearer on what is happening, then I guess we need to try and find out how the gateway manages to avoid overriding the button presses.

Achronite commented 6 months ago

Sorry for multiple posts... I've done an update to develop just for energenie-ener314rt which now outputs the underlying id and type (command or status) for each record. This should make debugging the gateway messages much clearer to distinguish.

So with FULLTRACE enabled (I've update trace.h this time for you) you'll see something like:

**********************************HRF_readfifo_burst_cbp() len=13, data:12:4:18:1:252:173:232:254:218:231:166:12:184:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
openThings_receive(): hdr: {"deviceId":1468762,"mfrId":4,"productId":18,"timestamp":1704627905
openThings_receive(): rec:0 {"name":"WAKEUP","id":89(status),"datatype":1,"str":"","int":0,"float":14.398438}
openThings_receive(): Returning: {"deviceId":1468762,"mfrId":4,"productId":18,"timestamp":1704627905,"WAKEUP":0,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":1468762,"mfrId":4,"productId":18,"timestamp":1704627905,"WAKEUP":0,"command":0,"retries":0,"cmd":"monitor"}
HRF_readfifo_burst_cbp() len=15, data:14:4:18:227:70:123:112:248:236:155:30:55:109:100:74:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":1468762,"mfrId":4,"productId":18,"timestamp":1704627905
openThings_receive(): rec:0 {"name":"TEMPERATURE","id":244(command),"datatype":1,"str":"","int":4864,"float":19.000000}
openThings_receive(): Returning: {"deviceId":1468762,"mfrId":4,"productId":18,"timestamp":1704627905,"TEMPERATURE":4864,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":1468762,"mfrId":4,"productId":18,"timestamp":1704627905,"TEMPERATURE":4864,"command":0,"retries":0,"cmd":"monitor"}
HRF_readfifo_burst_cbp() len=17, data:16:4:18:117:106:183:195:184:210:44:253:50:184:205:153:180:123:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
@openThings_receive(): hdr: {"deviceId":1468762,"mfrId":4,"productId":18,"timestamp":1704627906
openThings_receive(): rec:0 {"name":"REL_HUMIDITY","id":104(status),"datatype":1,"str":"","int":75,"float":75.000000}
openThings_receive(): rec:1 {"name":"THERMOSTAT_MODE","id":42(status),"datatype":1,"str":"","int":0,"float":0.000000}
openThings_receive(): Returning: {"deviceId":1468762,"mfrId":4,"productId":18,"timestamp":1704627906,"REL_HUMIDITY":75,"THERMOSTAT_MODE":0,"command":0,"retries":0}
mqtt-ener314rt http monitor received: {"deviceId":1468762,"mfrId":4,"productId":18,"timestamp":1704627906,"REL_HUMIDITY":75,"THERMOSTAT_MODE":0,"command":0,"retries":0,"cmd":"monitor"}

Can you please download this update and then perform a number of tests? the main thing is to capture the command data being issued. If they could be annotated (did nothing / changed temp in app / switched on via button, etc) then all the better.

sgulati-hub commented 6 months ago

@Achronite It seems currently Energenie server having some issues (gateway appearing offline on the app and web). I will deploy updates and try some commands once Energenie server/app issue is resolved. Also, I have got couple of other issues on HA side: 1) My Thermostat is now appearing as Radiator valve (MIHO013) on the dashboard. Instead of Thermostat (MIHO069). (nb: I do not have MiHome Radiator valves) 2) In addition the Thermostat (appearing as Radiator valve) HA dashboard also shows 2 additional Radiator valves (Radiator 3 and Radiator 18). All parameters (Temp, humidity etc) for these two are unknown. I tried deleting these additional devices (mqtt devices on HA) but they appear again after sometime.

Achronite commented 6 months ago

You need to stop mqtt-energenie then remove the discovery entries (under homeassistant path) on the Mqtt server using Mqtt explorer or equiv.

Then restart; try and watch for weird entries when it sends out the discovery messages in the log; let me know if you see anything dodgy.

Achronite commented 6 months ago

@sgulati-hub It might be worth you downloading energenie-ener314rt again, I've backed-out a 10us SPI delay that I added to try and get the rpi5 working in v0.7 (this didn't fix it BTW).

The new code is much quicker at the 'minute timing', read as my-newt 😃, and you are less likely to miss the commands.

sgulati-hub commented 6 months ago

@Achronite I have deployed the latest develop code for energenie-ener314rt. Logs around following 4 actions (all performed from the App/gateway on the Thermostat) are attached. In all cases logs are covering from the time action taken on the app to the time action reflected on the device and then on the HA. There is some noise in the logs due to other devices. 1) Thermostat switched OFF using app/gateway (Line 4 to 190) 2) Thermostat switched ON using app/gateway (Line 198 to 352) 3) TARGET TEMPERATURE INCREASED using app/gateway (Line 360 to 464) 4) TARGET TEMPERATURE DECREASED using app/gateway (Line 471 to end)

LogsJan8.txt

Achronite commented 6 months ago

Thank you for doing the tests, but unfortunately only test (4) shows the (command) in the log that I need. It looks like test 4 also includes test 3 as it contains two separate commands ones 16.5 ( "TARGET_TEMP","id":203(command)...."float":16.500000) & 14 at lines 521 & 522 being issued within the same message, with 14 ultimately winning!

Can you please repeat the thermostat mode ones to capture the (command) issued? You may find it quicker to monitor the log until you see "id":xxx (command)"; If you are using the service, you should be able to do this by: journalctl -fu mqtt-energenie-ener314rt.service

sgulati-hub commented 6 months ago

@Achronite Reason for the issuing two commands in the test 4 may also be due to the slider on the MiHome app being slightly fiddly. Regarding first two tests, I had captured full logs covering the time period till the command reflected on the device and then on the HA (+few seconds both sides). So, those command should have been captured in here unless there is a possibility of delay in recording logs more that 10-15 seconds. I will test again those thermostat mode commands anyway. I have also noticed that change of Thermostat mode (ON/OFF) via App takes up to a minute in reflecting on the device while the change in the target temperature reflects much quicker (15 to 20 seconds).

Achronite commented 6 months ago

The thermostat only listens for commands for a small window after it sends a WAKEUP, once every minute, so the temperature changes or thermostat mode command can only be processed then. The gateway (and my code) listens for these and then quickly sends its cached command to hit the small Rx window of the thermostat.

So the problem seems to be that whilst the pi board is outputting the WAKEUP, the cached command is being quickly sent out by the gateway; and therefore sometimes being missed by the board in the pi.

This is what I meant by minute timing issues. It should just be a matter of trial and error to finally capture what '(command)' the gateway is sending during this time.

I hope that's made it clearer for you, please ask if you don't understand what I mean.

sgulati-hub commented 6 months ago

@Achronite Thanks for the explanation. I am noticing a consistent pattern in the Thermostat sending WAKEUP command within few seconds of any change in the target temperature in the App. Hence was having some doubt that gateway was somehow able to "wakeup" Thermostat whenever it wants to. E.g. probably a OOK message to the paired gateway to wake it up.

Achronite commented 6 months ago

@Achronite Thanks for the explanation. I am noticing a consistent pattern in the Thermostat sending WAKEUP command within few seconds of any change in the target temperature in the App. Hence was having some doubt that gateway was somehow able to "wakeup" Thermostat whenever it wants to. E.g. probably a OOK message to the paired gateway to wake it up.

I don't have a gateway and I still see a WAKEUP approx every minute. I think it was just coincidence that your temperature change was nearer to the WAKEUP.

sgulati-hub commented 6 months ago

OK sure. I will record more logs to see and establish a link (if any) between temperature change on the app and WAKEUP.

Achronite commented 6 months ago

OK sure. I will record more logs to see and establish a link (if any) between temperature change on the app and WAKEUP.

It's the thermostat mode that I'm after (On/Off), we have a TEMPERATURE already. Although i reckon it is possible for temperature change button presses to be overriden via the app if it is done between WAKEUPs...

sgulati-hub commented 6 months ago

@Achronite I am not seeing any command journalctl -fu mqtt-energenie-ener314rt.service | grep "[\(]command[\)]" after issuing ON/OFF from the app for thermostat. Tired till well after the time command was issued and reflected on the Thermostat and then on HA.

Although managed to see the commands for switching ON/OFF Adapter Plus (MIHO005) via App as following:

openThings_receive(): rec:0 {"name":"SWITCH_STATE","id":243(command),"datatype":1,"str":"","int":1,"float":1.000000}
openThings_receive(): rec:0 {"name":"SWITCH_STATE","id":243(command),"datatype":1,"str":"","int":0,"float":0.000000}
Achronite commented 6 months ago

I am not seeing any command

😞 @sgulati-hub OK no probs, I think maybe the best course of action is to just let the gateway manage the thermostat for a few days, and then check the log for any (command) entries related to the thermostat. Am I right in thinking that the app shows the current temperature and humidity read by the thermostat? Do you know how often it updates in the app?

The reason I'm asking is that, without a gateway, the thermostat only ever sends WAKEUP signals; and these don't contain the temperature, etc. It only ever reports the temperature, etc after it processes a 'command'. That's why I think there must be some other command being sent to the thermostat from the gateway for it to report it's telemetry; even when nothing is happening....

sgulati-hub commented 6 months ago

@Achronite Yes app shows the current temperature and humidity. It seems it updates quite frequently (every minute or so) as I can see every change in temperature (jump of 0.1 C) and humidity in the app.

Achronite commented 6 months ago

Other than WAKEUPs does anything appear in the pi logs when these updates happen?

Achronite commented 6 months ago

I've updated the develop branch of energenie-ener314rt to modify the names of the parameters when they are commands (ie sent by the gateway). These parameters now have '_' added to them so that they can be easily identified in the logs and MQTT.

image

NOTE: I've disabled debug in trace.h within this update to try and increase the chance of capturing the commands from the gateway.

@sgulati-hub I would just leave this running for a while, and then check MQTT to see if it has manged to capture any '_' params.

sgulati-hub commented 6 months ago

@Achronite I have captured following. Will try to find these in the logs and send those across.

Achronite commented 6 months ago

@Achronite I have captured following. Will try to find these in the logs and send those across.

Thanks. Looks like there are only 2 commands then, which are the same as I'm using already. I'm particularly interested in any periodic ones that are sent out to just get the telemetry, and are not related to you doing anything that interacts with the thermostat.

Achronite commented 6 months ago

@DrOwl @sgulati-hub I have received some technical information on the thermostat from energenie after requesting a while back. They mention a parameter 'Hysteresis', is there anything in the MiHome app that mentions this, as I have no idea what it does!

sgulati-hub commented 6 months ago

@Achronite Thermostat user manual shows screenshots of the app. 'Hysteresis' can probably be linked to response time parameters in the app.

Achronite commented 6 months ago

I think I have worked out how the thermostat prevents commands overwriting button presses on the device!

When the thermostat receives a command it ignores that command IF a button press has been made for that particular command. For example:

  1. Change temperature on the thermostat using buttons to '18'
  2. Before a WAKEUP is received from the thermostat, set temperature to 19 in HA
  3. WAKEUP is sent from thermostat
  4. This module sends a TARGET_TEMP=19 message
  5. The thermostat responds to the command, but because a button press has been made it ignores the command, but it does return TARGET_TEMP=18

So I should, at this point, be able to stop any further requests to change the target temperature.

By the way I'm working on getting a whole new load of commands working for the thermostat; I'm just having difficulties at the moment as I seem to have set the reporting interval to a stupidly high value (hours, if not days!), and I cant seem to reset it!

Achronite commented 6 months ago

@sgulati-hub @DrOwl I''ve finished updating the code to support the thermostat (excluding SET_REPORTING_INTERVAL) can you please download (you will need the develop branch of both this and of energenie-ener314rt) and give it a test and let me know.

There are a few new settings: Parameter Description Topics Data Discovery type
RELAY_POLARITY Set relay polarity, where
0=Normally Open, 1=Normally Closed
command 0,1 switch
HUMID_OFFSET Set relative humidity offset for callibration command -20..20 number
TEMP_OFFSET Set temperature offset for callibration command -20..20 number
HYSTERISIS aka Temp Margin, set the difference between the current temperature and target temperature before the thermostat triggers command 0.5-10.0 number

I've also fixed the issue with the commands overriding the button presses; it would be good to see if it also 'plays nice' with the settings in the MiHome Hub app.

The new params do not currently have a reported MQTT state topic; I would be interested in your views on this.

@genestealer In this update there are a couple of changes for the eTRV too; including supporting 0.5 increments on the TARGET_TEMP.

genestealer commented 6 months ago

Excited to see, what are the eTRV changes?

Achronite commented 6 months ago

Excited to see, what are the eTRV changes?

Apart from 0.5 increments being supported I think it is the addition of 'Identify', 'Battery Updated' and 'Diagnostics Ran'. See here for full details

Achronite commented 6 months ago

I've now added the (retained) state for the 4 new commands above using the mechanism to only set it when telemetry is returned.

From README.md:

" A different mechanism of reporting processed commands has been implemented for the thermostat. When (and only when) the thermostat procesess a command it outputs it's telemetry data. This mechanism has been exploited, for values that do not get reported back by the thermostat (RELAY_POLARITY,HUMID_OFFSET,TEMP_OFFSET,HYSTERISIS) to assume for the command that has just been sent to the device (upon WAKEUP) has now been processed succesfully; at this point the retained state of the command is set in MQTT copying the command values."