smar000 / evoGateway

Python script for listening in and responding to evohome heating control radio messages
46 stars 17 forks source link

Non existent devices added to new device list #22

Closed lloyda closed 3 years ago

lloyda commented 3 years ago

I'm picking up a packet with Invalid Manchester code. It's being decoded as device type 12. I've accounted for all my devices, so I suspect it may be something else on 868 which is being picked up. Rather than adding the device to the new device table, would it not be better to wait until a valid packet had been received from the device and then add it?

smar000 commented 3 years ago

I just had a quick look at the code, and that is precisely what is supposed to be happening.

Line 1765: We try to read the message:
msg = get_message_from_data(data_row, serial_port.tag)

The get_message_from_data() function returns none if the message data does not match the regex.

Then lines 1769/70, if the msg object is not none the message gets processed:

if msg and not (DROP_DUPLICATE_MESSAGES and is_duplicate) : 
              msg = process_received_message(msg)

It is during process_received_message() that new devices are saved.

Can you double check your log files and see if there is any other row with a valid message pattern with a device id 12.

lloyda commented 3 years ago

Here you are. Log from a fresh start. Let me know if you need anything else.

more evogateway.log
-----------------------------------------------------------
2020-10-23 10:34:14 |1| ERR: INVALID MSG   # evofw3 0.4.4
2020-10-23 10:34:30 |1| SYNC               --- 067  I --- 01:185426 --:------ 01:185426 1F09 003 FF06E0
2020-10-23 10:34:30 |1| SETPOINT_CTL       --- 067  I --- 01:185426 --:------ 01:185426 2309 009 0005DC0105DC0206D6
2020-10-23 10:34:30 |1| ZONE_TEMPERATURE   --- 065  I --- 01:185426 --:------ 01:185426 30C9 009 00073A0106820206DD
2020-10-23 10:34:52 |1| ZONE_TEMPERATURE   --- 057  I --- 04:003222 --:------ 04:003222 30C9 003 00072B
2020-10-23 10:35:11 |1| ACTUATOR_CHECK_REQ --- 068  I --- 13:197705 --:------ 13:197705 3B00 002 00C8
2020-10-23 10:35:11 |1| ACTUATOR_CHECK_REQ --- 066  I --- 01:185426 --:------ 01:185426 3B00 002 FCC8
2020-10-23 10:35:11 |1| ACTUATOR_STATE     --- 068  I --- 13:197705 --:------ 13:197705 3EF0 003 0000FF
2020-10-23 10:37:26 |1| SYNC               --- 066  I --- 01:185426 --:------ 01:185426 1F09 003 FF06E0
2020-10-23 10:37:26 |1| SETPOINT_CTL       --- 067  I --- 01:185426 --:------ 01:185426 2309 009 0005DC0105DC0206D6
2020-10-23 10:37:26 |1| ZONE_TEMPERATURE   --- 065  I --- 01:185426 --:------ 01:185426 30C9 009 00072B0106820206DD
2020-10-23 10:37:35 |1| ZONE_TEMPERATURE   --- 038  I --- 04:003224 --:------ 04:003224 30C9 003 00068D
2020-10-23 10:38:24 |1| ZONE_HEAT_DEMAND   --- 064  I --- 04:003154 --:------ 01:185426 3150 002 0218
2020-10-23 10:38:59 |1| SETPOINT_OVERRIDE  --- 085  I --- 01:185426 --:------ 01:185426 2349 013 02064004FFFFFF0013170A07E4
2020-10-23 10:38:59 |1| SETPOINT           --- 084  I --- 01:185426 --:------ 01:185426 2309 003 020640
2020-10-23 10:40:22 |1| SYNC               --- 068  I --- 01:185426 --:------ 01:185426 1F09 003 FF06E0
2020-10-23 10:40:22 |1| ZONE_INFO          --- 068  I --- 01:185426 --:------ 01:185426 000A 018 001001F40DAC011001F40DAC02100
1F40DAC
2020-10-23 10:40:50 |1| SETPOINT           --- 037  I --- 04:003224 --:------ 01:185426 2309 003 0105DC
2020-10-23 10:43:08 |1| ERR: INVALID MSG   092  I --- --:------ --:------ 12:089598 1030 016 01C80137 * Invalid Manchester Cod
e
2020-10-23 10:43:08 |1| ERR: INVALID MSG   # A9.9A.A5.A9.99.59.55.56.A9.AA.A5.AA.A9.AA.AA.A9.5A.6A.AA.A9.A5.95.58.
2020-10-23 10:43:08 |1| RELAY_HEAT_DEMAND  --- 094  I --- --:------ --:------ 12:089598 0008 002 0000
2020-10-23 10:43:10 |1| ERR: INVALID MSG   090  I --- --:------ --:------ --:------ ???? ???  * Invalid Manchester Code
2020-10-23 10:43:10 |1| ERR: INVALID MSG   # A9.9A.A1.
2020-10-23 10:43:11 |1|                    091  I --- --:------ --:------ 12:089598 1030 016 01C80137C9010FCA0196CB010FCC0101
2020-10-23 10:43:12 |1| ERR: INVALID MSG   093 RQ --- --:------ --:------ --:------ ???? ???  * Invalid Manchester Code
2020-10-23 10:43:12 |1| ERR: INVALID MSG   # A9.8C.
2020-10-23 10:43:18 |1| SYNC               --- 067  I --- 01:185426 --:------ 01:185426 1F09 003 FF06E0
2020-10-23 10:43:18 |1| SETPOINT_CTL       --- 068  I --- 01:185426 --:------ 01:185426 2309 009 0005DC0105DC0205DC
2020-10-23 10:43:18 |1| ZONE_TEMPERATURE   --- 069  I --- 01:185426 --:------ 01:185426 30C9 009 00072B01068D0206DD
2020-10-23 10:43:26 |1| ZONE_HEAT_DEMAND   --- 067  I --- 04:003154 --:------ 01:185426 3150 002 0200
2020-10-23 10:43:27 |1| ZONE_HEAT_DEMAND   --- 066  I --- 01:185426 --:------ 01:185426 3150 002 FC00
2020-10-23 10:44:22 |1| RELAY_HEAT_DEMAND  --- 066  I --- 01:185426 --:------ 01:185426 0008 002 FC00
2020-10-23 10:45:11 |1| ACTUATOR_STATE     --- 071  I --- 13:197705 --:------ 13:197705 3EF0 003 0000FF
2020-10-23 10:45:13 |1| ACTUATOR_CHECK_REQ --- 067  I --- 01:185426 --:------ 01:185426 3B00 002 FCC8
2020-10-23 10:46:14 |1| SYNC               --- 079  I --- 01:185426 --:------ 01:185426 1F09 003 FF06E0
2020-10-23 10:46:14 |1| SETPOINT_CTL       --- 079  I --- 01:185426 --:------ 01:185426 2309 009 0005DC0105DC0205DC
2020-10-23 10:46:14 |1| ZONE_TEMPERATURE   --- 075  I --- 01:185426 --:------ 01:185426 30C9 009 00072B01068D0206DD
smar000 commented 3 years ago

2020-10-23 10:43:08 |1| RELAY_HEAT_DEMAND --- 094 I --- --:------ --:------ 12:089598 0008 002 0000

This line looks as if it will match the regex, and thus saving to the new device file if the device is not already present. Command 0008 is a heat request (https://github.com/Evsdd/The-Evohome-Protocol/wiki/0008:-Relay-Heat-Demand).

lloyda commented 3 years ago

Ah yes, I see the issue now. Out of interest, do the three lines at 10:43:08 represent two or three messages?

smar000 commented 3 years ago

Those are 3 separate messages received from the firmware in your arduino into the script. I couldn't tell you whether the it is a single message going into the firmware or 3 separate messages sent very fast etc.