Skip to content

Instantly share code, notes, and snippets.

@thomasloven
Last active June 30, 2020 15:09
Show Gist options
  • Save thomasloven/6d99d953251597bf0fcc442d604569e4 to your computer and use it in GitHub Desktop.
Save thomasloven/6d99d953251597bf0fcc442d604569e4 to your computer and use it in GitHub Desktop.
Select rooms to clean with xiaomi
# In <config>/python_scripts/
vacuum = "vacuum.xiaomi_vacuum_cleaner"
zones = {
"hallen": 24,
"koket": 22,
"vardagsrummet": 23,
"sovrum": 17,
"kontoret": 16,
"barnrum": 1,
}
toClean = []
for k,v in zones.items():
if hass.states.is_state(f'input_boolean.dammsug_{k}', 'on'):
toClean.append(v)
hass.services.call( "vacuum", "send_command", {
"entity_id": "vacuum.xiaomi_vacuum_cleaner",
"command": "app_segment_clean",
"params": toClean,
})
...
python_script:
input_boolean:
dammsug_hallen:
dammsug_koket:
dammsug_vardagsrummet:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment