Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daniele-athome/roborock-v1-dustbin
A very dirty hack for publishing dustbin state to MQTT for Valetudo
https://github.com/daniele-athome/roborock-v1-dustbin
mqtt roborock valetudo xiaomi
Last synced: 4 days ago
JSON representation
A very dirty hack for publishing dustbin state to MQTT for Valetudo
- Host: GitHub
- URL: https://github.com/daniele-athome/roborock-v1-dustbin
- Owner: daniele-athome
- Created: 2022-08-01T21:08:09.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-12-08T23:02:08.000Z (11 months ago)
- Last Synced: 2024-10-11T01:19:25.403Z (26 days ago)
- Topics: mqtt, roborock, valetudo, xiaomi
- Language: Shell
- Homepage:
- Size: 8.79 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Roborock Dustbin
================Xiaomi Roborock 1st generation vacuum robots (`rockrobo.vacuum.v1`) don't publish dustbin state through their API.
This shell script will watch a log file written by one of the original firmware processes for a special string that can
tell us when the dustbin is removed and put back into place. It will then publish a message to the standard Valetudo
attachment state MQTT topic `valetudo//AttachmentStateAttribute/dustbin` with a payload of either "true"
(dustbin installed) of "false" (dustbin removed).## Installation
You will require a rooted vacuum robot with Valetudo already installed. You will also need to install with apt-get:
* mosquitto-clients (depends on libmosquitto0)
* jqCopy `dustbin.sh` into `/usr/local/bin/dustbin` and give it execution permissions.
To start it at boot there is a sample upstart configuration file in `upstart/dustbin.conf` that should do the job
(although I just copied it from Valetudo and I didn't really know what I was doing :P). Place that into `/etc/init` and
reboot the robot.## Internals
The log file we are watching is `/var/run/shm/EVENTTASK_normal.log`.
Whenever the dustbin is removed the following lines will appear:
```
51304923 T908 pRecvEventInternal:2182 [stat] IPCWrapper: received 76 bytes from 0x4, Id = 0x104001e(30)
51304923 T908 TransformPacketToEvent:1326 [stat] IPCWrapper: transformed Message ID 0x104001e as Event 0xb5100478(RE_Mcu_BinOut)
51304923 T908 ListenerRoutineInternal:1375 [stat] Queue: Listener push event 0xb5100478(RE_Mcu_BinOut) into MediumQ(Size = 0)
51304923 T895 GetEvent:2535 [stat] Queue: Pop event 0xb5100478(RE_Mcu_BinOut) from the MediumQ(Size = 0)
51304924 T895 main:1376 [stat] Processing Event 0xb5100478(21)
51304925 T909 DoSpeaker:200 [stat] Speaker /mnt/data/rockrobo/sounds/bin_out.wav, Volume 90
```And the following after putting back the dustbin into place:
```
51308003 T908 pRecvEventInternal:2182 [stat] IPCWrapper: received 76 bytes from 0x4, Id = 0x104001e(30)
51308003 T908 TransformPacketToEvent:1326 [stat] IPCWrapper: transformed Message ID 0x104001e as Event 0xb5100478(RE_Mcu_BinIn)
51308003 T908 ListenerRoutineInternal:1375 [stat] Queue: Listener push event 0xb5100478(RE_Mcu_BinIn) into MediumQ(Size = 0)
51308003 T895 GetEvent:2535 [stat] Queue: Pop event 0xb5100478(RE_Mcu_BinIn) from the MediumQ(Size = 0)
51308003 T895 main:1376 [stat] Processing Event 0xb5100478(20)
51308004 T909 DoSpeaker:200 [stat] Speaker /mnt/data/rockrobo/sounds/bin_in.wav, Volume 90
```What we do in the script is just tailing the log file and watching for those "RE_Mcu_Bin" strings.
MQTT connection data is read directly from Valetudo config file at `/mnt/data/valetudo_config.json`.