eschava / broadlink-mqtt

MQTT client to control BroadLink devices
MIT License
224 stars 61 forks source link

RM Pro recording zeroes until restarted #58

Closed adamcstephens closed 1 year ago

adamcstephens commented 4 years ago

Hello,

I noticed commands were not always recording correctly. It appears that the recorder will become confused and not work correctly until a restart.

I added some debugging to https://github.com/eschava/broadlink-mqtt/blob/08f101b1a5978437a91f092cb9285ad9f0471ac0/mqtt.py#L247

In the bad state, here is an example:

app_1  | [2020-01-26 20:44:30,553] DEBUG Received MQTT message broadlink/tv/sony/power record
app_1  | [2020-01-26 20:44:30,553] DEBUG Recording command to file /app/commands/tv/sony/power
app_1  | [2020-01-26 20:44:35,560] DEBUG #packet: b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
app_1  | [2020-01-26 20:44:35,560] DEBUG Done
-> cat commands/tv/sony/power
000000000000000000000000

Once restarted, same thing works:

app_1  | [2020-01-26 20:44:54,957] DEBUG Connected to 'RM2' Broadlink device at 'broadlink.private' (MAC XX:XX) and started listening for commands at MQTT topic having prefix 'broadlink/'
app_1  | [2020-01-26 20:44:54,963] DEBUG Connected to MQTT broker, subscribing to topic broadlink/#
app_1  | [2020-01-26 20:45:01,296] DEBUG Received MQTT message broadlink/tv/sony/power record
app_1  | [2020-01-26 20:45:01,296] DEBUG Recording command to file /app/commands/tv/sony/power
app_1  | [2020-01-26 20:45:06,440] DEBUG #packet: b'&\x00\xc4\x00P\x13(\x13\x15\x12)\x13\x14\x13(\x13\x15\x12\x15\x13(\x13\x15\x12\x15\x13\x15\x12\x15\x00\x03HO\x13)\x12\x15\x13(\x13\x15\x12)\x12\x15\x13\x15\x12)\x12\x15\x13\x15\x12\x15\x13\x15\x00\x03GP\x12)\x12\x15\x13(\x13\x15\x12)\x13\x14\x13\x15\x12)\x13\x14\x13\x15\x12\x15\x13\x15\x00\x03GP\x13(\x13\x15\x12*\x11\x15\x13)\x12\x16\x11\x16\x12)\x12\x15\x12\x16\x12\x15\x12\x16\x00\x03FQ\x12)\x12\x16\x11*\x12\x15\x12)\x12\x16\x12\x15\x12)\x12\x16\x12\x15\x12\x16\x11\x16\x00\x03GP\x12*\x11\x16\x12)\x12\x16\x11*\x11\x16\x12\x16\x11*\x11\x16\x12\x16\x11\x16\x12\x15\x00\x03GQ\x11*\x12\x15\x12)\x12\x16\x12)\x12\x15\x12\x16\x12)\x12\x15\x12\x16\x11\x16\x12\x16\x00\r\x05\x00\x00\x00\x00'
app_1  | [2020-01-26 20:45:06,441] DEBUG Done
tsdaemon commented 4 years ago

Same for me. I was able to learn codes after a restart.