Home Assistant release with the issue:
0.99.3
Operating environment (Hass.io/Docker/Windows/etc.):
Hass.io
Integration:
https://www.home-assistant.io/integrations/vacuum.xiaomi_miio/
Description of problem:
I've tried to add my Xiaomi Mijia STYJ02YM lauched in the middle of august. But it seems that the integration can't reach the robot.
I've retreived the token using MiToolKit. I've checked the ip directely on the router.
There are 3 messages in the log (provided in the traceback).
Problem-relevant configuration.yaml
entries and (fill out even if it seems unimportant):
vacuum:
- platform: xiaomi_miio
host: 192.168.1.208
token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Traceback (if applicable):
Update of vacuum.xiaomi_vacuum_cleaner is taking over 10 seconds
Got exception while fetching the state: No response from the device
Got error when receiving: timed out
Additional information:
Hey there @rytilahti, @syssi, mind taking a look at this issue as its been labeled with a integration (xiaomi_miio
) you are listed as a codeowner for? Thanks!
i have same issue
First step would be to ensure if it is working with miiocli or mirobo command-lne tool. Timeouts happen when there is no response from the acuum, so there is not much we can do there until that is solved.
Is homeassistant in the same network as the vacuum? Do mirobo discover
and mirobo discover --handshake 1
show the vacuum?
There is an issue open on the python-miio repository.
https://github.com/rytilahti/python-miio/issues/550
Same issue.
Token was retrieved by an extract of miio2.db and verified by using app 5.4.49 logs.
Here is a part of the result for miiocli -d device --ip 192.168.0.Y --token XXX info
INFO:miio.cli:Debug mode active
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.device:Got a response: Container:
data = Container:
data = b'' (total 0)
value = b'' (total 0)
offset1 = 32
offset2 = 32
length = 0
header = Container:
data = b'!1\x00 \x00\x00\x00\x00\x10\x91\xf1\xbc]\x9d"N' (total 16)
value = Container:
length = 32
unknown = 0
device_id = b'\x10\x91\xf1\xbc' (total 4)
ts = 2019-10-08 23:57:02
offset1 = 0
offset2 = 16
length = 16
checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
DEBUG:miio.device:Discovered 1091f1bc with ts: 2019-10-08 23:57:02, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.device:192.168.0.14:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
DEBUG:miio.device:Retrying with incremented id, retries left: 3
Any retry leads to the same issue.
Hope it helps...
reset the vacuum to factory state (wifi ap mode), connect to ap and try to discover or get token by sending hello packet to the vacuum
https://github.com/jghaanstra/com.xiaomi-miio/blob/master/docs/obtain_token.md (bottom)
and try to inspect. technically vacuum can drop local miio api AFTER provisioning, but it should work in factory state, because mi home is using generic method miIO.config_router to setup cloud connection.
I can't get correctly token like the way you show. It's show me another token if I reset the vacuum again and again.
Hope anyone can help me!!!!plz!
reset the vacuum to factory state (wifi ap mode), connect to ap and try to discover or get token by sending hello packet to the vacuum
https://github.com/jghaanstra/com.xiaomi-miio/blob/master/docs/obtain_token.md (bottom)
and try to inspect. technically vacuum can drop local miio api AFTER provisioning, but it should work in factory state, because mi home is using generic method miIO.config_router to setup cloud connection.
token changes on each wifi reset, but your goal is to reset wifi (disconnect vacuum from cloud), get the token and check if you can talk to vacuum when it's not connected to cloud. it looks like it close local miio api after you connect it to wifi/cloud.
I try like this:
don't do point 3, don't connect it to cloud (it will change token and probably disable local api).
when you get token in point 2 use python miio or mirobo send raw command for example
miiocli device --ip 192.168.8.1 --token 00112233445566778899aabbccddeeff info
or
mirobo --ip 192.168.8.1 --token 00112233445566778899aabbccddeeff raw-command miIO.info
If dont do point 3, how can robo connect to my wifi? and when to connect robo to Mihome?
just confirm local api is working and let us know. i will check how and where they disable it after cloud connection is done.
hi everybody! I have a problem with Xiaomi STYJ02YM. Before an update I had 2 modes on this robot: vacuum and mop. After an update which I received recently I have 3 modes: Vacuum, Vacuum+Mop and Mop. If I choose only Mop mode I have an error: "water reservoir(tank) is not installed, please install water tank", but I already installed 2 in 1 water tank. And right now I can't use only Mop function on this vacuum, but previously everything was fine.
I tried to factory reset it, but a new firmware is still on this robot.
So my question is: can anybody have this kind of problem and can I reset this robot to a previous firmware?
Thank you very much!
Hi leotreble, mine 'mops only' well without the tank filter.
@leotreble, regarding to your issue I've seen video on YT with same problem and one comment states that after update for "mopping only" mode you need separate tank which is not included to the vacuum. I expect this tank is only for the water (not dust) and can carry more water. If you want to use your normal tank which is for dust+water you may need to use "vacuum + mop" mode after this update.
Hi all
have you manage to integrate the STYJ02YM in hassio?
Was ready to buy it, but want to be sure it will work
Thanks
Hello @Kitem19 some people are working on it but nothing is sure at this time. There are some questions about the API being accessible without the Xiaomi cloud (local API).
Hello @Kitem19 some people are working on it but nothing is sure at this time. There are some questions about the API being accessible without the Xiaomi cloud (local API).
Thanks.
Do you maybe suggest to buy the S6, instead?
Is it better integrated?
I don't know about the S6. The S5 still a very good solution for now.
Any updates on this?
Basic support is available in the most recent python-miio release, some more features were added with https://github.com/rytilahti/python-miio/pull/590 . The homeassistant integration needs to be updated to allow defining the model to use (as this uses a different protocol, and we cannot reliably detect this for non-cloud connected gen1 vacuums).
Hi @rytilahti
Thanks for the update.
If I well understood the project made some steps forward, but the hassio/homeassistant integration is still not working. Am I right?
Home assistant integration use the python library made by @rytilahti . This library has been updated after the last release of HA. So we have to wait the next release of HA in order to use the last version of the python library.
Thanks
Since it's my first time with this vacuum, I hope you will share the "how to..." guide to help me using it in HA :-)
Wish you great time
@Kitem19 yes, you got it right! The backend library has now support for that device, and using that requires changes in the homeassistant integration.
@HydrelioxGitHub, bumping the version is not enough as this is a different implementation and will require modifications to the vacuum platform (i.e., adding ability to choose which implementation to use, much like with some other xiaomi_miio platforms).
Hello all! I am also looking forward for update regarding update on this topic.
Hello Guys,
Have anyone added live paths to home assistant on non rooted vacuums?
I used the custom component created by nqkdev based on @rytilahti to integrate my vacuum in home assistant (vacuum STYJ02YM, non rooted). I made some small changes to include live path of the vacuum. The live path is based on sending a raw command (get_curpos). Get_curpos returns a list containing [x_pos, y_pos, rotation, mode,...].
The length of the list is varying.
Position units are given in meters.
It works quite well except the update request for the position is to low in my current setup so I'm missing some positions to get the complete path.
This is how it looks on my home assistant cleaning my hall:
And in mi home:
@Chrolden where can I find this custom component?
@Chrolden where can I find this custom component?
This is the orginal custom integration.
The one I made with live map is currently not available. It needs more work to have a better resolution for the live path
https://github.com/nqkdev/home-assistant-vacuum-styj02ym
this is some great news. Will test it this weekend. Thanks fot sharing!
How you send the vacum to the room? I have problem with that:
`test_vacuum:
alias: Test Vacuum
sequence:
Unable to send command to the vacuum: No response from the device
10:03 PM custom_components/miio2/vacuum.py (ERROR) - message first occurred at 9:44 PM and shows up 7 times
@ciubas use vacuum.send_command
command: set_mode_withroom
params: [a, b, c, d]
Correct me if I am wrong : where a = 0 or 1( 1= clean only along edges, 0 normal clean,
B= clean mode, c = numbers of rooms 0 or the number of room you want to clean.
For example cleaning my kitchen =
command: set_mode_withroom
params: [0, 1, 1, 11]
11 = room id
Cleaning both kitchen and hall =
command: set_mode_withroom
params: [0, 1, 2, 11, 12]
11,12= room id (kitchen and hall)
Remember to have comma and space like the example above.
Hope this is clear
If you @ciubas don't know your room I'd try room 10, 11,...
If you use wrong room id it will just say: zone clean started.
Than move a bit and return.
To have English language.
Send:
command: set_language
params: 2
Work perfect! Now I need find the room numbers :)
`test_vacuum:
alias: Test Vacuum
sequence:
Mop ora 2in1 is 2?
params: [0,2,1,1] ?
params: [0, 2, 1, 1]
2 means pause.
Hmm - where can i find all information about this parameters? Mayby how MOP? :) Or how do this zone cleanup like on the s50:
vacuum_mop:
alias: Vacuum Water
sequence:
Most parameters are not documented yet.
Supported commands can be found: https://github.com/rytilahti/python-miio/issues/550#issuecomment-552780952
Some of the parameters is documented here
https://github.com/rytilahti/python-miio/commit/57c10097b7b86094bea19dff73c17cefdd1103a5
Most parameters are not documented yet.
Supported commands can be found: rytilahti/python-miio#550 (comment)
Some of the parameters is documented here
rytilahti/python-miio@57c1009
Thank you!
I cant find the solution for:
app_zoned_clean - to use cordinates not room number
fan_speed - or somethning like that to change vacuum to 2in1 (vacuum and mop) option
app_goto_target - to send him to the bathroom for cleaning
I cant find the solution for:
app_zoned_clean - to use cordinates not room number
fan_speed - or somethning like that to change vacuum to 2in1 (vacuum and mop) option
app_goto_target - to send him to the bathroom for cleaning
App_goto_target is not supported as far as I know.
fan_speed is fully built into the custom component.
Zoned cleaning is defined in the custom component with the service: vacuum.xiaomi_clean_zone
And spot cleaning is defined with the service: vacuum.xiaomi_clean_point
Reading the source code of the component explains some:
https://github.com/nqkdev/home-assistant-vacuum-styj02ym/blob/master/vacuum.py
Thanks!
My robot just rotate the map... and room has been change too... :/
Its work for me too:
test_vacuum:
alias: Test Vacuum
sequence:
service: vacuum.send_command
data:
entity_id: vacuum.Bambo
command: set_language
params: 2
service: vacuum.xiaomi_clean_zone
data:
entity_id: vacuum.Bambo
zone: [[-2,0,3,-3]]
repeats: 1
Hello Guys,
Have anyone added live paths to home assistant on non rooted vacuums?
I used the custom component created by nqkdev based on @rytilahti to integrate my vacuum in home assistant (vacuum STYJ02YM, non rooted). I made some small changes to include live path of the vacuum. The live path is based on sending a raw command (get_curpos). Get_curpos returns a list containing [x_pos, y_pos, rotation, mode,...].
The length of the list is varying.
Position units are given in meters.
It works quite well except the update request for the position is to low in my current setup so I'm missing some positions to get the complete path.
This is how it looks on my home assistant cleaning my hall:
And in mi home:
Any chance you could share your lovelace config for the robot?
Of course @greengo1 !
My code is a bit messy and need some clean up:
Picture of card in UI:

Love Lace Code:
cards:
- elements:
- icon: 'mdi:bell-ring'
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
left: 80%
top: 95%
tap_action:
action: call-service
service: vacuum.locate
service_data:
entity_id: vacuum.xiaomi_vacuum_cleaner
type: icon
- icon: 'mdi:pause'
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
left: 35%
top: 95%
tap_action:
action: call-service
service: vacuum.pause
service_data:
entity_id: vacuum.xiaomi_vacuum_cleaner
type: icon
- icon: 'mdi:home'
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
left: 65%
top: 95%
tap_action:
action: call-service
service: vacuum.return_to_base
service_data:
entity_id: vacuum.xiaomi_vacuum_cleaner
type: icon
- icon: 'mdi:stop'
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
left: 50%
top: 95%
tap_action:
action: call-service
service: vacuum.stop
service_data:
entity_id: vacuum.xiaomi_vacuum_cleaner
type: icon
- icon: 'mdi:play'
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
left: 20%
top: 95%
tap_action:
action: call-service
service: vacuum.start
service_data:
entity_id: vacuum.xiaomi_vacuum_cleaner
type: icon
- entity: sensor.vacuum_cleanmode
prefix: 'Mode: '
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
border-left-style: solid
font-size: 90%
font-weight: bold
left: 1%
pointer-events: none
top: 15%
transform: none
type: state-label
- entity: sensor.vacuum_battery
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
border-left-style: solid
font-size: 90%
font-weight: bold
left: 1%
pointer-events: none
top: 35%
transform: none
type: state-label
- entity: sensor.vacuum_fan_speed
prefix: 'Fan: '
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
border-left-style: solid
font-size: 90%
font-weight: bold
left: 1%
pointer-events: none
top: 25%
transform: none
type: state-label
- entity: sensor.vacuum_dustbox
prefix: 'Box: '
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
border-left-style: solid
font-size: 90%
font-weight: bold
left: 1%
pointer-events: none
top: 45%
transform: none
type: state-label
- entity: sensor.vacuum_mop
prefix: 'Mop: '
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
border-left-style: solid
font-size: 90%
font-weight: bold
left: 1%
pointer-events: none
top: 55%
transform: none
type: state-label
- entity: sensor.vacuum_cleaned_area
prefix: 'Area: '
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
font-size: 110%
font-weight: bold
left: 30%
pointer-events: none
top: 80%
type: state-label
- entity: sensor.vacuum_cleaning_time
prefix: 'Time: '
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
font-size: 110%
font-weight: bold
pointer-events: none
right: 1%
top: 80%
suffix: ' min'
type: state-label
- entity: sensor.vacuum_cleanmainbrush
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
border-right-style: solid
font-size: 90%
font-weight: bold
pointer-events: none
right: 1%
top: 15%
transform: none
type: state-label
- entity: sensor.vacuum_cleansidebrush
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
border-right-style: solid
font-size: 90%
font-weight: bold
pointer-events: none
right: 1%
top: 25%
transform: none
type: state-label
- entity: sensor.vacuum_sensordirtyleft
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
border-right-style: solid
font-size: 90%
font-weight: bold
pointer-events: none
right: 1%
top: 35%
transform: none
type: state-label
- entity: sensor.vacuum_cleanfilter
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
border-right-style: solid
font-size: 90%
font-weight: bold
pointer-events: none
right: 1%
top: 45%
transform: none
type: state-label
- entity: vacuum.xiaomi_vacuum_cleaner
style:
'--paper-item-icon-color': 'rgb(115, 122, 130)'
font-size: 150%
font-weight: bold
left: 50%
top: 8%
tap_action:
action: more-info
type: state-label
image: /local/vacuum.png
type: picture-elements
- entities:
- entity: input_select.vacuum_room
type: entities
type: 'custom:vertical-stack-in-card'
Config.yaml (Room selector):
input_select:
vacuum_room:
name: Choose a room to clean
options:
- Select Input
- bedroom
- guest room
- hall
- kitchen
- living room
Sensor.yaml :
- platform: template
sensors:
vacuum_status:
friendly_name: Status
entity_id:
- vacuum.xiaomi_vacuum_cleaner
value_template: 'Status: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.status }}'
icon_template: >
{% set val = states.vacuum.xiaomi_vacuum_cleaner.attributes.status %}
{% if val == 'Charging' %}
mdi:battery-charging
{% elif val == 'Cleaning' %}
mdi:move-resize
{% elif val == 'Returning home' %}
mdi:keyboard-return
{% elif val == 'Idle' %}
mdi:dots-horizontal
{% elif val == 'Paused' %}
mdi:pause-circle
{% else %}
mdi:help-circle
{% endif %}
vacuum_fan_speed:
friendly_name: Fan Speed
entity_id:
- vacuum.xiaomi_vacuum_cleaner
value_template: '{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.fan_speed }}'
icon_template: 'mdi:speedometer'
vacuum_battery:
friendly_name: Vacuum Battery
entity_id:
- vacuum.xiaomi_vacuum_cleaner
value_template: 'Battery: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.battery_level }}'
unit_of_measurement: '%'
icon_template: '{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.battery_icon }}'
vacuum_cleaning_time:
friendly_name: Time of Last Cycle
entity_id:
- vacuum.xiaomi_vacuum_cleaner
value_template: '{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.s_time }}'
icon_template: 'mdi:timer'
vacuum_cleaned_area:
friendly_name: Area of Last Cycle
unit_of_measurement: 'm ²'
entity_id:
- vacuum.xiaomi_vacuum_cleaner
value_template: '{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.s_area }}'
icon_template: 'mdi:ruler'
vacuum_cleanmainbrush:
friendly_name: Replace main brush
unit_of_measurement: 'h'
entity_id:
- vacuum.xiaomi_vacuum_cleaner
value_template: 'Main Brush: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.main_brush_hours }}'
icon_template: 'mdi:screwdriver'
vacuum_cleansidebrush:
friendly_name: Replace side brush
unit_of_measurement: 'h'
entity_id:
- vacuum.xiaomi_vacuum_cleaner
value_template: 'Side Brush: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.side_brush_hours }}'
icon_template: 'mdi:screwdriver'
vacuum_cleanfilter:
friendly_name: Replace filter
unit_of_measurement: 'h'
entity_id:
- vacuum.xiaomi_vacuum_cleaner
value_template: 'Filter: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.hypa_hours }}'
icon_template: 'mdi:screwdriver'
vacuum_sensordirtyleft:
friendly_name: Replace mop
unit_of_measurement: 'h'
entity_id:
- vacuum.xiaomi_vacuum_cleaner
value_template: 'Mop: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.mop_hours }}'
icon_template: 'mdi:screwdriver'
vacuum_mop:
friendly_name: Is mop installed
entity_id:
- vacuum.xiaomi_vacuum_cleaner
value_template: >-
{% if states.vacuum.xiaomi_vacuum_cleaner.attributes.mop_type == 1 %}
Installed
{% else %}
Not Installed
{% endif %}
icon_template: 'mdi:screwdriver'
vacuum_dustbox:
friendly_name: dustbox type
entity_id:
- vacuum.xiaomi_vacuum_cleaner
value_template: >-
{% if states.vacuum.xiaomi_vacuum_cleaner.attributes.box_type == 1 %}
Dustbox
{% elif states.vacuum.xiaomi_vacuum_cleaner.attributes.box_type == 3 %}
2 in 1 Watertank
{% else %}
Not Installed
{% endif %}
icon_template: 'mdi:screwdriver'
vacuum_cleanmode:
friendly_name: Cleaning Mode
entity_id:
- vacuum.xiaomi_vacuum_cleaner
value_template: >-
{% if states.vacuum.xiaomi_vacuum_cleaner.attributes.box_type == 3 and states.vacuum.xiaomi_vacuum_cleaner.attributes.mop_type == 1 %}
Vacuum & Mop
{% elif states.vacuum.xiaomi_vacuum_cleaner.attributes.box_type == 1 %}
Vacuum
{% else %}
Not Ready
{% endif %}
icon_template: 'mdi:screwdriver'
script.yaml :
vacuum_livingroom:
alias: Clean Living Room
sequence:
- data:
command: set_mode_withroom
params:
- 0
- 1
- 1
- 12
entity_id: vacuum.xiaomi_vacuum_cleaner
service: vacuum.send_command
vacuum_guestroom:
alias: Clean Guest Room
sequence:
- data:
command: set_mode_withroom
params:
- 0
- 1
- 1
- 13
entity_id: vacuum.xiaomi_vacuum_cleaner
service: vacuum.send_command
vacuum_kitchen:
alias: Clean Kitchen
sequence:
- data:
command: set_mode_withroom
entity_id: vacuum.xiaomi_vacuum_cleaner
params:
- 0
- 1
- 1
- 10
entity_id: vacuum.xiaomi_vacuum_cleaner
service: vacuum.send_command
vacuum_hall:
alias: Clean Hall
sequence:
- data:
command: set_mode_withroom
params:
- 0
- 1
- 1
- 11
entity_id: vacuum.xiaomi_vacuum_cleaner
service: vacuum.send_command
Automations:
- id: Cleaning_rooms
alias: Start Cleaning Room
hide_entity: true
trigger:
- platform: state
entity_id: input_select.vacuum_room
from: Select Input
action:
- service: script.turn_on
data_template:
entity_id: "{% if is_state(\"input_select.vacuum_room\", \"bedroom\") %}\n \
\ script.vacuum_bedroom\n{% elif is_state(\"input_select.vacuum_room\", \"\
guest room\") %}\n script.vacuum_guestroom\n{% elif is_state(\"input_select.vacuum_room\"\
, \"hall\") %}\n script.vacuum_hall\n{% elif is_state(\"input_select.vacuum_room\"\
, \"kitchen\") %}\n script.vacuum_kitchen\n{% elif is_state(\"input_select.vacuum_room\"\
, \"living room\") %}\n script.vacuum_livingroom\n{% else %} {% endif %}\n"
- service: input_select.select_option
entity_id: input_select.vacuum_room
data_template:
option: Select
Vacuum picture:
Many thanks @Chrolden ! You saved me and probably other current and future owners a lot of time and hassle.
Of course @greengo1 !
My code is a bit messy and need some clean up:
Picture of card in UI:
Love Lace Code:
Config.yaml (Room selector):
script.yaml :
Vacuum picture:
thank you!! Now my mop is working in home assistant
please may you share next configurations? or may you explain please how to clean exact room? I see a list of rooms but it is not working, mop clean all house anyway
Of course @greengo1 !
My code is a bit messy and need some clean up:
Picture of card in UI:
Love Lace Code:
Config.yaml (Room selector):
script.yaml :
Vacuum picture:thank you!! Now my mop is working in home assistant
please may you share next configurations? or may you explain please how to clean exact room? I see a list of rooms but it is not working, mop clean all house anyway
Sorry I have forgotten to include my automation in the comment above.
I have updated the comment with automations no: https://github.com/home-assistant/home-assistant/issues/27268#issuecomment-576890353
Remember you need to find out what is correct room number your self.
You can find that with using command set_mode_withroom.. as I have explained earlier.
Of course @greengo1 !
My code is a bit messy and need some clean up:
Picture of card in UI:
Love Lace Code:
Config.yaml (Room selector):
script.yaml :
Automations:
Vacuum picture:
Thank you Chrolden for your configuration - great work. I did exactly what you have in your configuration with few changes and I don't have any information data back in right side of the card (main, side brush,mop, filter). What firmware do you use in your STYJ02YM?
Of course @greengo1 !
My code is a bit messy and need some clean up:
Picture of card in UI:
Love Lace Code:
Config.yaml (Room selector):
script.yaml :
Automations:
Vacuum picture:Thank you Chrolden for your configuration - great work. I did exactly what you have in your configuration with few changes and I don't have any information data back in right side of the card (main, side brush,mop, filter). What firmware do you use in your STYJ02YM?
You need to modify the vacuum.py file located in \config\custom_components\miio2 folder.
On line 122:
#Change this:
ALL_PROPS = ["run_state", "mode", "err_state", "battary_life", "box_type", "mop_type", "s_time",
"s_area", "suction_grade", "water_grade", "remember_map", "has_map", "is_mop", "has_newmap"]
#to:
ALL_PROPS = ["run_state", "mode", "err_state", "battary_life", "box_type", "mop_type", "s_time",
"s_area", "suction_grade", "water_grade", "remember_map", "has_map", "is_mop", "has_newmap", "side_brush_hours", "main_brush_hours", "hypa_hours", "mop_hours"]
Than you should get information about remaining hours on brush, mop...
My live map feature is working quite well now (Non rooted vacuum). However the code need some clean up.
The live map feature I have built now is including clean path and also a current posistion of the vacuum.
If I have time I might add a custom component if anyone are interested.
This is how my live map looks now:
Vacuum just started cleaning the hall.
Vacuum almost finish cleaning.
Vacuum finished cleaning( You can see the Vacuum right under the TV stand)
My live map feature is working quite well now (Non rooted vacuum). However the code need some clean up.
The live map feature I have built now is including clean path and also a current posistion of the vacuum.
If I have time I might add a custom component if anyone are interested.
This is how my live map looks now:Vacuum just started cleaning the hall.
This map looks fantastic. I keep my fingers crossed for this custom pomponent. Thank you for your help and your work.
This issue is about missing integration in the homeassistant core, so could you please move the discussion about custom components to the discussion forum.. Thanks!
This issue is about missing integration in the homeassistant core, so could you please move the discussion about custom components to the discussion forum.. Thanks!
Ofc. My mistake.
Sorry, I'm new to github.
Hi everyone, it is nice to see that there is interest on getting this device integrated, but I pleaded you already to keep the discussion not related to the issue at hand out from the issue tracker. I just purged the new unrelated comments written after that point – this issue is only for tracking the integration to HA core.
Feel free to use the community forums (https://community.home-assistant.io) or the issues repository of the custom component (https://github.com/nqkdev/home-assistant-vacuum-styj02ym) for further discussion about the custom component.
If there are some functionality missing from the backend library that is hindering the integration, feel free to open an issue or a PR at https://github.com/rytilahti/python-miio/. Thanks!
Hi everyone, it is nice to see that there is interest on getting this device integrated, but I pleaded you already to keep the discussion not related to the issue at hand out from the issue tracker. I just purged the new unrelated comments written after that point – this issue is only for tracking the integration to HA core.
Feel free to use the community forums (https://community.home-assistant.io) or the issues repository of the custom component (https://github.com/nqkdev/home-assistant-vacuum-styj02ym) for further discussion about the custom component.
If there are some functionality missing from the backend library that is hindering the integration, feel free to open an issue or a PR at https://github.com/rytilahti/python-miio/. Thanks!
whats wrong with you buddy? i registered here looking for an answer and you deleted all questions and comments. hope you are satisfied with yourself
I'm fine, thanks for asking. I already tried friendly to point out that github issues is not the place for support requests nor is it a discussion forum, and I even gave you direct links where the discussion should be continued. I also did not remove any prior offtopic comments as a courtesy as I don't mind small amounts of helpful discussion, but there are limits to that.
Btw, going around insulting people with that tone is a great way to motivate them. Feel free to work on the integration yourself and/or escalate your issues about my moderation. I'm done here and won't interfere with this issue anymore, I also hope you are satisfied with your contributions to this community.
@bullgod-mort In fact github works kinda different than usual forum groups and it's right that our discussion was offtopic. There is other places here to talk about components problems. Teemu R. is contributor here and he has right to decide how this topic should look like.
@rytilahti Please dont be mad, that situation was just missunderstanding what github really is. We're all here trully gratefull for your contribution of this integration. Thanks for your work and sorry for being part of that offtopic case.
It solved!
https://github.com/nqkdev/home-assistant-vacuum-styj02ym?files=1
What exactly has been fixed?
This is still valid, the recently merged PR was only a roadblocker for this issue (to allow differing fan speed mappings). Fixing this will require still changes to the integration, namely either 1) adding auto-detection of the device type or 2) adding a configuration to use ViomiVacuum
class when suitable.
Can you update the current information of this PR?
What information are you missing then? The current state (including needed actions) is in my last comment already, so far I haven't seen any volunteers to implement it.
Hello, I just recently got this vacuum, viomi.vacuum.v8. I have tried with miiocli, and it shows some info:
Model: viomi.vacuum.v8
Hardware version: Linux
Firmware version: 3.5.3_0017
Network: {'localIp': '192.168.1.23', 'mask': '255.255.255.0', 'gw': '192.168.1.1'}
AP: {'ssid': 'XXX', 'bssid': 'XXX'}
So I guess I have the correct token, but adding to HA did nothing, I only got an error. I see that there were some PR regarding this, shouldn't I have at least see the state of the device in HA or something besides unavailable?
I see that there is an unofficial "hacky" integration here :)
https://github.com/nqkdev/home-assistant-vacuum-styj02ym
Can't it be made into something official?
It is not worth to maintain two separate integrations in the core, so no, there's no way to make it official. If there are some features that are missing in python-miio (looks like that custom integration uses raw_command
for some use cases), those should be upstreamed as necessary.
miiocli viomivacuum
is the command you can also use to command the vacuum from console, the steps I stated in the previous comment will still be done before we can add support for non-rockrobo vacuums (viomis & dreames) into the core integration.
How can I help? I have Viomi V3 and STYJ02YM (v7 CN version) in my house.
I cant to get any info from my device. STYTJ02YM (viomi-v8) Is the process for v8 different ?
I extracted the token as per below but when I try and use that token to talk to the vacuum I get no response.
Any suggestions?
Below is the process I followed.
1 install latest version of python-miio using pip3 install python-miio ( Successfully installed python-miio-0.5.3 )
mirobo --ip 192.168.5.1 --token XXXXXX326B7A35654D32646F6FXXXXXX raw-command miIO.info
Sending cmd miIO.info with params []
Error: Unable to request miIO.info from the device
miiocli device --ip 192.168.5.1 --token XXXXXX326B7A35654D32646F6FXXXXXX info
Error: Unable to request miIO.info from the device
Try to add the debug flag to your invocations, it will show you what is being received and maybe give a hint what could be the problem. That error message indicates that the device responded with something (unexpected, non-json response) instead of simply timing out what usually happens when the token is incorrect.
Try to add the debug flag to your invocations, it will show you what is being received and maybe give a hint what could be the problem. That error message indicates that the device responded with something (unexpected, non-json response) instead of simply timing out what usually happens when the token is incorrect.
@rytilahti
I have added the debug flag and in addition I have also done a packet capture on the interface and grabbed the response back from the vacuum. I am not sure what to expect in the response but it looks like is its sending me back another token the same one I sent in as the magic packet as well as the tocken I sent it from the PC in the mirobo command. Maybe this means something to somebody here?
21310020ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
21310020ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
21310020ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
2131002000000000126ebbd70000adab6771723256655964726277486f777a4e
2131002000000000126ebbd70000adab6771723256655964726277486f777a4e
2131002000000000126ebbd70000adab6771723256655964726277486f777a4e
mirobo -d --ip 192.168.5.1 --token 6771723256655964726277486F777A4E raw-command miIO.info
INFO:miio.vacuum_cli:Debug mode active
DEBUG:miio.vacuum_cli:Connecting to 192.168.5.1 with token 6771723256655964726277486F777A4E
Sending cmd miIO.info with params []
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.miioprotocol:Got a response: Container:
data = Container:
data = b'' (total 0)
value = b'' (total 0)
offset1 = 32
offset2 = 32
length = 0
header = Container:
data = b'!1\x00 \x00\x00\x00\x00\x12n\xbb\xd7\x00\x00\xad\xa6' (total 16)
value = Container:
length = 32
unknown = 0
device_id = unhexlify('126ebbd7')
ts = 1970-01-01 12:20:54
offset1 = 0
offset2 = 16
length = 16
checksum = b'gqr2VeYdrbwHowzN' (total 16)
DEBUG:miio.miioprotocol:Discovered 126ebbd7 with ts: 1970-01-01 12:20:54, token: b'6771723256655964726277486f777a4e'
DEBUG:miio.miioprotocol:192.168.5.1:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
DEBUG:miio.miioprotocol:Retrying with incremented id, retries left: 3
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.miioprotocol:Got a response: Container:
data = Container:
data = b'' (total 0)
value = b'' (total 0)
offset1 = 32
offset2 = 32
length = 0
header = Container:
data = b'!1\x00 \x00\x00\x00\x00\x12n\xbb\xd7\x00\x00\xad\xab' (total 16)
value = Container:
length = 32
unknown = 0
device_id = unhexlify('126ebbd7')
ts = 1970-01-01 12:20:59
offset1 = 0
offset2 = 16
length = 16
checksum = b'gqr2VeYdrbwHowzN' (total 16)
DEBUG:miio.miioprotocol:Discovered 126ebbd7 with ts: 1970-01-01 12:20:59, token: b'6771723256655964726277486f777a4e'
DEBUG:miio.miioprotocol:192.168.5.1:54321 >>: {'id': 102, 'method': 'miIO.info', 'params': []}
DEBUG:miio.miioprotocol:Retrying with incremented id, retries left: 2
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.miioprotocol:Got a response: Container:
data = Container:
data = b'' (total 0)
value = b'' (total 0)
offset1 = 32
offset2 = 32
length = 0
header = Container:
data = b'!1\x00 \x00\x00\x00\x00\x12n\xbb\xd7\x00\x00\xad\xb0' (total 16)
value = Container:
length = 32
unknown = 0
device_id = unhexlify('126ebbd7')
ts = 1970-01-01 12:21:04
offset1 = 0
offset2 = 16
length = 16
checksum = b'gqr2VeYdrbwHowzN' (total 16)
DEBUG:miio.miioprotocol:Discovered 126ebbd7 with ts: 1970-01-01 12:21:04, token: b'6771723256655964726277486f777a4e'
DEBUG:miio.miioprotocol:192.168.5.1:54321 >>: {'id': 203, 'method': 'miIO.info', 'params': []}
DEBUG:miio.protocol:Unable to parse json '': Expecting value: line 1 column 1 (char 0)
DEBUG:miio.click_common:Exception: Unable to parse message payload
Traceback (most recent call last):
File "/home/vodor/.local/lib/python3.7/site-packages/miio/protocol.py", line 193, in _decode
return json.loads(decoded)
File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/vodor/.local/lib/python3.7/site-packages/miio/click_common.py", line 59, in __call__
return self.main(args, *kwargs)
File "/home/vodor/.local/lib/python3.7/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/vodor/.local/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/vodor/.local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, *ctx.params)
File "/home/vodor/.local/lib/python3.7/site-packages/click/core.py", line 610, in invoke
return callback(args, *kwargs)
File "/home/vodor/.local/lib/python3.7/site-packages/click/decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, *kwargs)
File "/home/vodor/.local/lib/python3.7/site-packages/click/core.py", line 610, in invoke
return callback(args, *kwargs)
File "/home/vodor/.local/lib/python3.7/site-packages/miio/vacuum_cli.py", line 644, in raw_command
click.echo(vac.raw_command(cmd, params))
File "/home/vodor/.local/lib/python3.7/site-packages/miio/device.py", line 165, in raw_command
return self.send(command, parameters)
File "/home/vodor/.local/lib/python3.7/site-packages/miio/device.py", line 147, in send
command, parameters, retry_count, extra_parameters=extra_parameters
File "/home/vodor/.local/lib/python3.7/site-packages/miio/miioprotocol.py", line 236, in send
extra_parameters=extra_parameters,
File "/home/vodor/.local/lib/python3.7/site-packages/miio/miioprotocol.py", line 236, in send
extra_parameters=extra_parameters,
File "/home/vodor/.local/lib/python3.7/site-packages/miio/miioprotocol.py", line 193, in send
m = Message.parse(data, token=self.token)
File "/home/vodor/.local/lib/python3.7/site-packages/construct/core.py", line 288, in parse
return self.parse_stream(io.BytesIO(data), **contextkw)
File "/home/vodor/.local/lib/python3.7/site-packages/construct/core.py", line 300, in parse_stream
return self._parsereport(stream, context, "(parsing)")
File "/home/vodor/.local/lib/python3.7/site-packages/construct/core.py", line 312, in _parsereport
obj = self._parse(stream, context, path)
File "/home/vodor/.local/lib/python3.7/site-packages/construct/core.py", line 1981, in _parse
subobj = sc._parsereport(stream, context, path)
File "/home/vodor/.local/lib/python3.7/site-packages/construct/core.py", line 312, in _parsereport
obj = self._parse(stream, context, path)
File "/home/vodor/.local/lib/python3.7/site-packages/construct/core.py", line 2439, in _parse
return self.subcon._parsereport(stream, context, path)
File "/home/vodor/.local/lib/python3.7/site-packages/construct/core.py", line 312, in _parsereport
obj = self._parse(stream, context, path)
File "/home/vodor/.local/lib/python3.7/site-packages/construct/core.py", line 3987, in _parse
obj = self.subcon._parsereport(stream, context, path)
File "/home/vodor/.local/lib/python3.7/site-packages/construct/core.py", line 312, in _parsereport
obj = self._parse(stream, context, path)
File "/home/vodor/.local/lib/python3.7/site-packages/construct/core.py", line 4265, in _parse
obj = self.subcon._parsereport(stream, context, path)
File "/home/vodor/.local/lib/python3.7/site-packages/construct/core.py", line 312, in _parsereport
obj = self._parse(stream, context, path)
File "/home/vodor/.local/lib/python3.7/site-packages/construct/core.py", line 698, in _parse
return self._decode(obj, context, path)
File "/home/vodor/.local/lib/python3.7/site-packages/miio/protocol.py", line 201, in _decode
) from ex
miio.exceptions.PayloadDecodeException: Unable to parse message payload
Error: Unable to parse message payload
Maybe the info command is not working on that device? Something similar happens on rockrobo gen1 vacuums if they are not cloud connected, even when the other commands work. Do all other viomivacuum commands also cause the same error?
Maybe the info command is not working on that device? Something similar happens on rockrobo gen1 vacuums if they are not cloud connected, even when the other commands work. Do all other viomivacuum commands also cause the same error?
Tried other commands but I get "no response from device"
I then tried the miiocli command specifically with the viomivacuum switch and I can get a status response this way at least.
I don't know how to connect it to the wifi after this step though (other than using the app) and after that I cant get any info out of it again.
miiocli viomivacuum --ip 192.168.5.1 --token 323776595A70656876594D3xxxxCxxxx status
State: ViomiVacuumState.Idle
Mode: ViomiMode.Vacuum
Error: Unknown error 0
Battery: 95
Fan speed: ViomiVacuumSpeed.Silent
Box type: ViomiBinType.Vacuum
Mop type: 0
Clean time: 0:01:14
Clean area: 58.36
Water grade: ViomiWaterGrade.Low
Remember map: True
Has map: True
Has new map: False
Mop mode: ViomiMode.Vacuum
I am getting the same issue with my vacuum. It is working through the android app, and using npm miio, it is only from Home Assistant that I am finding it not working
Configuration.yaml
`vacuum:
Error
2020-08-10 21:47:15 DEBUG (SyncWorker_2) [miio.miioprotocol] Discovered 126edfca with ts: 2020-08-10 20:47:15, token: b'ffffffffffffffffffffffffffffffff'
2020-08-10 21:47:15 DEBUG (SyncWorker_2) [miio.miioprotocol] 192.168.1.224:54321 >>: {'id': 2028, 'method': 'get_status', 'params': []}
2020-08-10 21:47:20 DEBUG (SyncWorker_2) [miio.miioprotocol] Retrying with incremented id, retries left: 1
2020-08-10 21:47:20 DEBUG (SyncWorker_2) [miio.miioprotocol] Got a response: Container:
data = Container:
data = b'' (total 0)
value = b'' (total 0)
offset1 = 32
offset2 = 32
length = 0
header = Container:
data = b'!1\x00 \x00\x00\x00\x00\x12n\xdf\xca_1\xb2Y' (total 16)
value = Container:
length = 32
unknown = 0
device_id = b'\x12n\xdf\xca' (total 4)
ts = 2020-08-10 20:47:21
offset1 = 0
offset2 = 16
length = 16
checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
Any idea what is going on, or is there any more information that I can gather?
The integration supports only rockrobo vacuums at the moment, there is a custom component linked previously in this issue that allows using viomi vacuums with homeassistant. The steps to properly integrate support for these is also contained in some of the previous comments.
The integration supports only rockrobo vacuums at the moment, there is a custom component linked previously in this issue that allows using viomi vacuums with homeassistant. The steps to properly integrate support for these is also contained in some of the previous comments.
Thanks this explains a bit. I will read the comments and see what bits are relevant to viomi.
Việc tích hợp chỉ hỗ trợ máy hút bụi rockrobo tại thời điểm hiện tại, có một thành phần tùy chỉnh được liên kết trước đó trong số này cho phép sử dụng máy hút bụi viomi với chất gia cố. Các bước để tích hợp đúng cách hỗ trợ cho những điều này cũng có trong một số nhận xét trước đây.
Cảm ơn điều này giải thích một chút. Tôi sẽ đọc các bình luận và xem những bit nào có liên quan đến viomi.
https://github.com/nqkdev/home-assistant-vacuum-styj02ym
Custom compoments viomi gen 2
Could the python-mioo be updated for HA > 0.113? Simply editing the manifest.json to reflect 5.0.3 did not work for me... I'm not sure what else to change.
Currently this is breaking the Xiaomi Miio Gateway Alarm integration built into Home Assistant. Downgrading HA to <0.113 will fix the issue.
[edit
Fixed it myself, by changing the manifast.json to "python-miio==0.5.3" (instead of '0.5.0.3') :-)
The integration supports only rockrobo vacuums at the moment, there is a custom component linked previously in this issue that allows using viomi vacuums with homeassistant. The steps to properly integrate support for these is also contained in some of the previous comments.
thanks. managed to get it working. it was surprisingly easy. I ended up not resetting my vacuum at all and left it on the wifi as is. Then installed the older version of the mi home app version v5.4.45 in bluestacks. Got the token and it worked first time.
Most helpful comment
I'm fine, thanks for asking. I already tried friendly to point out that github issues is not the place for support requests nor is it a discussion forum, and I even gave you direct links where the discussion should be continued. I also did not remove any prior offtopic comments as a courtesy as I don't mind small amounts of helpful discussion, but there are limits to that.
Btw, going around insulting people with that tone is a great way to motivate them. Feel free to work on the integration yourself and/or escalate your issues about my moderation. I'm done here and won't interfere with this issue anymore, I also hope you are satisfied with your contributions to this community.