teddycloud
teddycloud copied to clipboard
Send MQTT event when Tonie gets removed from the Toniebox
It would be very useful for Home Assistant integration if an MQTT event (value?) is send when the Tonie finally gets removed from the box.
From the Forum thread (regarding the behavior of a Creative Tonie):
I noticed that the
Content Audio Idfirst changes fromUnknownto the Id of the media I’ve recorded. When I remove the Tonie while this is playing it changes back toUnknown. But when I leave the Tonie on the box, as soon as my recorded audio is finished theContent Audio Idchanges to something else. When I now remove the Tonie the Id stays as it is.Values for
Tag Validare changing in a similar manner: When I remove the Tonie during my recorded audio plays the value changes back toUnknown. But when the recorded audio is finished theTag Validwon’t change anymore.
I checked the RTNL messages that occur when removing a Tonie and found that (besides a few others) the following messages appear every time:
Creative Tonie:
Raw2 | #1141 Uptime: 503842 Func: 15-8630 Payload: '10A41470E0040350' ASCII: '...p...P'
Raw2 | #1142 Uptime: 503842 Func: 24-6158 Payload: 'CA170000' ASCII: '....'
Benjamin Bluemchen Tonie:
Raw2 | #1521 Uptime: 884906 Func: 15-8630 Payload: '172091E4E0040350' ASCII: '. .....P'
Raw2 | #1523 Uptime: 884909 Func: 24-6139 Payload: 'CB170000CA170000' ASCII: '........'
Paddington Tonie:
Raw2 | #1428 Uptime: 743952 Func: 15-8630 Payload: '15EC056BE0040350' ASCII: '...k...P'
Raw2 | #1430 Uptime: 743955 Func: 24-6139 Payload: 'CB170000CA170000' ASCII: '........'
Perhaps this is a message we can use for this feature?
Perhaps we can have a MQTT value like Tonie present = True/False that is updated whenever a Tonie is placed/removed.
Do these also work after the tonies content was fully played?
PS: Here is the code responsible for the decoding. https://github.com/toniebox-reverse-engineering/teddycloud/blob/21f9c08e3daa13dde35991f7f568674f2e98641f/src/handler_rtnl.c#L156 https://github.com/toniebox-reverse-engineering/teddycloud/blob/master/include/handler_rtnl.h#L72
Yes, these are also working after the Tonie has been fully played (just went through a whole playback of Benjamin Bluemchen for it...).
After Benjamin finished I took the Tonie off and got this:
Raw2 | #331 Uptime: 2641791 Func: 15-8630 Payload: '172091E4E0040350' ASCII: '. .....P'
Raw2 | #332 Uptime: 2641791 Func: 24-6158 Payload: 'CA170000' ASCII: '....'
So it's similar to the one I'm getting for the finished Creative Tonie.
In addition: The following appears whenever I place a Tonie onto the box:
Raw2 | #381 Uptime: 2853368 Func: 15-8627 Payload: '172091E4E0040350' ASCII: '. .....P'
Raw3 | Datetime: 1707685649 Unknown: 11
Raw2 | #382 Uptime: 2853369 Func: 24-6139 Payload: 'CA170000CB170000' ASCII: '........'
Only thing that differs in 15-8627 is the Payload. Seems to be the ID of the Tonie I placed. I guess it's used in conjunction with the Timestamp, i.e. "Tonie XYZ has been placed at XX:YY".
Note that in 24-6139 the payload is in reverse to what is being shown when a Tonie is removed. It seems to be some kind of transition:
- Tonie is placed on the box:
CA170000CB170000 - Tonie is removed during play:
CB170000CA170000 - Tonie is removed after play finished:
CA170000
Which kind of box do you have?
It's a CC3200 with PD_V3.1.0_BF5-0 firmware.
It's a CC3200 with
PD_V3.1.0_BF5-0firmware.
Are you sure you are booting the PD Firmware? This shouldn't be the case, as this is a production firmware. Slot ofw2 doesn't boot mcuimg2.
Which kind of box do you have?
Has anyone experimented with this on V4 (ESP32) boxes? I am looking to make this work as well.