Webhook- / JSON-Expertise im Zusammenspiel mit Home Assistant gesucht

EDIT: Die Fragen haben sich erledigt - ich gehe inzwischen über die REST-API von Home Assistant und habe den Xiaomi über homee Webhooks bereits ans Laufen bekomen…

Hi,

ich spiele gerade mit meinem Xiaomi Robot herum, den ich vorgestern erfolgreich in Home Assistant (hass.io) integriert habe. Jetzt versuche ich via Webhook mit JSON-Payload an die HASS-API den Robot zu starten, komme aber nicht weiter und bin auch nach Suchen im Forum nicht wirklich schlauer geworden.

Meine konkreten Fragen in die Runde:

  • Wer hat schon mal via Webhook JSON-Daten erfolgreich an Home Assistant oder an Dritte Services übergeben bzw. hat JSON-Expertise um mir zu helfen mich in der Sache langsam voranzutasten?

  • Mit welcher Methode (Post/Put/Get) an welche URL von HASS verschicke ich überhaupt den Payload? Weder ein Post noch ein Put an /api noch an /api/services hat zu irgendeiner Reaktion im Log von HASS geführt (nicht mal eine Fehlermeldung).

  • Was wäre der korrekte JSON-Payload (mein letzter Webhook-Versuch ist oben dokumentiert) an die API? Die an der API angelieferten Daten sind unten in den Anlagen als Screenshot der Vacuum Domain in einem JSON-Parser, bzw. als Paste aller Schnittstellen aufgeführt.

Anlagen:

HASS gibt an der API (http://hassio.local:8123/api/services) folgende Services aus (relevant sind die unter Vacuum).

Hier die komplette Ausgabe der API als Paste (für diejenigen, die lieber alles sehen wollen):

[{“domain”: “homeassistant”, “services”: {“check_config”: {“description”: “Check the Home Assistant configuration files for errors. Errors will be displayed in the Home Assistant log.”, “fields”: {}}, “reload_core_config”: {“description”: “Reload the core configuration.”, “fields”: {}}, “restart”: {“description”: “Restart the Home Assistant service. It is normal to get a “Failed to call service homeassistant/restart” message.”, “fields”: {}}, “stop”: {“description”: “Stop the Home Assistant service. It is normal to get a “Failed to call service homeassistant/stop” message.”, “fields”: {}}, “toggle”: {“description”: “Generic service to toggle devices on/off under any domain. Same usage as the light.turn_on, switch.turn_on, etc. services.”, “fields”: {“entity_id”: {“description”: “The entity_id of the device to toggle on/off”, “example”: “light.living_room”}}}, “turn_off”: {“description”: “Generic service to turn devices off under any domain. Same usage as the light.turn_on, switch.turn_on, etc. services.”, “fields”: {“entity_id”: {“description”: “The entity_id of the device to turn off”, “example”: “light.living_room”}}}, “turn_on”: {“description”: “Generic service to turn devices on under any domain. Same usage as the light.turn_on, switch.turn_on, etc. services.”, “fields”: {“entity_id”: {“description”: “The entity_id of the device to turn on”, “example”: “light.living_room”}}}}}, {“domain”: “persistent_notification”, “services”: {“create”: {“description”: “Show a notification in the frontend”, “fields”: {“message”: {“description”: “Message body of the notification. [Templates accepted]”, “example”: “Please check your configuration.yaml.”}, “notification_id”: {“description”: “Target ID of the notification, will replace a notification with the same Id. [Optional]”, “example”: 1234}, “title”: {“description”: “Optional title for your notification. [Optional, Templates accepted]”, “example”: “Test notification”}}}, “dismiss”: {“description”: “Remove a notification from the frontend”, “fields”: {“notification_id”: {“description”: “Target ID of the notification, which should be removed. [Required]”, “example”: 1234}}}}}, {“domain”: “recorder”, “services”: {“purge”: {“description”: “Start purge task - delete events and states older than x days, according to keep_days service data.”, “fields”: {“keep_days”: {“description”: “Number of history days to keep in database after purge. Value >= 0”, “example”: 2}}}}}, {“domain”: “group”, “services”: {“reload”: {“description”: “Reload group configuration.”, “fields”: {}}, “remove”: {“description”: “Remove a user group”, “fields”: {“object_id”: {“description”: “Group id and part of entity id”, “example”: “test_group”}}}, “set”: {“description”: “Create/Update a user group”, “fields”: {“add_entities”: {“description”: “List of members they will change on group listening.”, “example”: “domain.entity_id1, domain.entity_id2”}, “control”: {“description”: “Value for control the group control”, “example”: “hidden”}, “entities”: {“description”: “List of all members in the group. Not compatible with ‘delta’”, “example”: “domain.entity_id1, domain.entity_id2”}, “icon”: {“description”: “Name of icon for the group”, “example”: “mdi:camera”}, “name”: {“description”: “Name of group”, “example”: “My test group”}, “object_id”: {“description”: “Group id and part of entity id”, “example”: “test_group”}, “view”: {“description”: “Boolean for if the group is a view”, “example”: true}, “visible”: {“description”: “If the group is visible on UI”, “example”: true}}}, “set_visibility”: {“description”: “Hide or show a group”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to set value”, “example”: “group.travel”}, “visible”: {“description”: “True if group should be shown or False if it should be hidden.”, “example”: true}}}}}, {“domain”: “notify”, “services”: {“holger_away”: {“description”: “Send a notification”, “fields”: {“data”: {“description”: “Extended information for notification. Optional depending on the platform.”, “example”: “platform specific”}, “message”: {“description”: “Message body of the notification.”, “example”: “The garage door has been open for 10 minutes.”}, “target”: {“description”: “An array of targets to send the notification to. Optional depending on the platform.”, “example”: “platform specific”}, “title”: {“description”: “Optional title for your notification.”, “example”: “Your Garage Door Friend”}}}, “holger_home”: {“description”: “Send a notification”, “fields”: {“data”: {“description”: “Extended information for notification. Optional depending on the platform.”, “example”: “platform specific”}, “message”: {“description”: “Message body of the notification.”, “example”: “The garage door has been open for 10 minutes.”}, “target”: {“description”: “An array of targets to send the notification to. Optional depending on the platform.”, “example”: “platform specific”}, “title”: {“description”: “Optional title for your notification.”, “example”: “Your Garage Door Friend”}}}}}, {“domain”: “logbook”, “services”: {“log”: {“description”: “”, “fields”: {}}}}, {“domain”: “automation”, “services”: {“reload”: {“description”: “Reload the automation configuration.”, “fields”: {}}, “toggle”: {“description”: “Toggle an automation.”, “fields”: {“entity_id”: {“description”: “Name of the automation to toggle on/off.”, “example”: “automation.notify_home”}}}, “trigger”: {“description”: “Trigger the action of an automation.”, “fields”: {“entity_id”: {“description”: “Name of the automation to trigger.”, “example”: “automation.notify_home”}}}, “turn_off”: {“description”: “Disable an automation.”, “fields”: {“entity_id”: {“description”: “Name of the automation to turn off.”, “example”: “automation.notify_home”}}}, “turn_on”: {“description”: “Enable an automation.”, “fields”: {“entity_id”: {“description”: “Name of the automation to turn on.”, “example”: “automation.notify_home”}}}}}, {“domain”: “wake_on_lan”, “services”: {“send_magic_packet”: {“description”: “Send a ‘magic packet’ to wake up a device with ‘Wake-On-LAN’ capabilities.”, “fields”: {“broadcast_address”: {“description”: “Optional broadcast IP where to send the magic packet.”, “example”: “192.168.255.255”}, “mac”: {“description”: “MAC address of the device to wake up.”, “example”: “aa:bb:cc:dd:ee:ff”}}}}}, {“domain”: “conversation”, “services”: {“process”: {“description”: “”, “fields”: {}}}}, {“domain”: “sensor”, “services”: {“update_speedtest”: {“description”: “”, “fields”: {}}}}, {“domain”: “media_player”, “services”: {“clear_playlist”: {“description”: “Send the media player the command to clear players playlist.”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to change source on”, “example”: “media_player.living_room_chromecast”}}}, “media_next_track”: {“description”: “Send the media player the command for next track.”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to send next track command to”, “example”: “media_player.living_room_sonos”}}}, “media_pause”: {“description”: “Send the media player the command for pause.”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to pause on”, “example”: “media_player.living_room_sonos”}}}, “media_play”: {“description”: “Send the media player the command for play.”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to play on”, “example”: “media_player.living_room_sonos”}}}, “media_play_pause”: {“description”: “Toggle media player play/pause state”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to toggle play/pause state on”, “example”: “media_player.living_room_sonos”}}}, “media_previous_track”: {“description”: “Send the media player the command for previous track.”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to send previous track command to”, “example”: “media_player.living_room_sonos”}}}, “media_seek”: {“description”: “Send the media player the command to seek in current playing media.”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to seek media on”, “example”: “media_player.living_room_chromecast”}, “seek_position”: {“description”: “Position to seek to. The format is platform dependent.”, “example”: 100}}}, “media_stop”: {“description”: “Send the media player the stop command.”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to stop on”, “example”: “media_player.living_room_sonos”}}}, “play_media”: {“description”: “Send the media player the command for playing media.”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to seek media on”, “example”: “media_player.living_room_chromecast”}, “media_content_id”: {“description”: “The ID of the content to play. Platform dependent.”, “example”: “https://home-assistant.io/images/cast/splash.png”}, “media_content_type”: {“description”: “The type of the content to play. Must be one of MUSIC, TVSHOW, VIDEO, EPISODE, CHANNEL or PLAYLIST”, “example”: “MUSIC”}}}, “select_source”: {“description”: “Send the media player the command to change input source.”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to change source on”, “example”: “media_player.media_player.txnr535_0009b0d81f82”}, “source”: {“description”: “Name of the source to switch to. Platform dependent.”, “example”: “video1”}}}, “shuffle_set”: {“description”: “Set shuffling state”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to set”, “example”: “media_player.spotify”}, “shuffle”: {“description”: “True/false for enabling/disabling shuffle”, “example”: true}}}, “sonos_clear_sleep_timer”: {“description”: “Clear a Sonos timer”, “fields”: {“entity_id”: {“description”: “Name(s) of entities that will have the timer cleared.”, “example”: “media_player.living_room_sonos”}}}, “sonos_join”: {“description”: “Group player together.”, “fields”: {“entity_id”: {“description”: “Name(s) of entities that will coordinate the grouping. Platform dependent.”, “example”: “media_player.living_room_sonos”}, “master”: {“description”: “Entity ID of the player that should become the coordinator of the group.”, “example”: “media_player.living_room_sonos”}}}, “sonos_restore”: {“description”: “Restore a snapshot of the media player.”, “fields”: {“entity_id”: {“description”: “Name(s) of entities that will be restored. Platform dependent.”, “example”: “media_player.living_room_sonos”}, “with_group”: {“description”: “True (default) or False. Restore with all group attributes.”, “example”: “true”}}}, “sonos_set_sleep_timer”: {“description”: “Set a Sonos timer”, “fields”: {“entity_id”: {“description”: “Name(s) of entities that will have a timer set.”, “example”: “media_player.living_room_sonos”}, “sleep_time”: {“description”: “Number of seconds to set the timer”, “example”: “900”}}}, “sonos_snapshot”: {“description”: “Take a snapshot of the media player.”, “fields”: {“entity_id”: {“description”: “Name(s) of entities that will be snapshot. Platform dependent.”, “example”: “media_player.living_room_sonos”}, “with_group”: {“description”: “True (default) or False. Snapshot with all group attributes.”, “example”: “true”}}}, “sonos_unjoin”: {“description”: “Unjoin the player from a group.”, “fields”: {“entity_id”: {“description”: “Name(s) of entities that will be unjoined from their group. Platform dependent.”, “example”: “media_player.living_room_sonos”}}}, “sonos_update_alarm”: {“description”: “”, “fields”: {}}, “toggle”: {“description”: “Toggles a media player power state”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to toggle”, “example”: “media_player.living_room_chromecast”}}}, “turn_off”: {“description”: “Turn a media player power off”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to turn off”, “example”: “media_player.living_room_chromecast”}}}, “turn_on”: {“description”: “Turn a media player power on”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to turn on”, “example”: “media_player.living_room_chromecast”}}}, “volume_down”: {“description”: “Turn a media player volume down”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to turn volume down on”, “example”: “media_player.living_room_sonos”}}}, “volume_mute”: {“description”: “Mute a media player’s volume”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to mute”, “example”: “media_player.living_room_sonos”}, “is_volume_muted”: {“description”: “True/false for mute/unmute”, “example”: true}}}, “volume_set”: {“description”: “Set a media player’s volume level”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to set volume level on”, “example”: “media_player.living_room_sonos”}, “volume_level”: {“description”: “Volume level to set as float”, “example”: 0.6}}}, “volume_up”: {“description”: “Turn a media player volume up”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to turn volume up on”, “example”: “media_player.living_room_sonos”}}}}}, {“domain”: “vacuum”, “services”: {“clean_spot”: {“description”: “Tell the vacuum cleaner to do a spot clean-up.”, “fields”: {“entity_id”: {“description”: “Name of the botvac entity.”, “example”: “vacuum.xiaomi_vacuum_cleaner”}}}, “locate”: {“description”: “Locate the vacuum cleaner robot.”, “fields”: {“entity_id”: {“description”: “Name of the botvac entity.”, “example”: “vacuum.xiaomi_vacuum_cleaner”}}}, “return_to_base”: {“description”: “Tell the vacuum cleaner to return to its dock.”, “fields”: {“entity_id”: {“description”: “Name of the botvac entity.”, “example”: “vacuum.xiaomi_vacuum_cleaner”}}}, “send_command”: {“description”: “Send a raw command to the vacuum cleaner.”, “fields”: {“command”: {“description”: “Command to execute.”, “example”: “set_dnd_timer”}, “entity_id”: {“description”: “Name of the botvac entity.”, “example”: “vacuum.xiaomi_vacuum_cleaner”}, “params”: {“description”: “Parameters for the command.”, “example”: “[22,0,6,0]”}}}, “set_fan_speed”: {“description”: “Set the fan speed of the vacuum cleaner.”, “fields”: {“entity_id”: {“description”: “Name of the botvac entity.”, “example”: “vacuum.xiaomi_vacuum_cleaner”}, “fan_speed”: {“description”: “Platform dependent vacuum cleaner fan speed, with speed steps, like ‘medium’, or by percentage, between 0 and 100.”, “example”: “low”}}}, “start_pause”: {“description”: “Start, pause, or resume the cleaning task.”, “fields”: {“entity_id”: {“description”: “Name of the botvac entity.”, “example”: “vacuum.xiaomi_vacuum_cleaner”}}}, “stop”: {“description”: “Stop the current cleaning task.”, “fields”: {“entity_id”: {“description”: “Name of the botvac entity.”, “example”: “vacuum.xiaomi_vacuum_cleaner”}}}, “toggle”: {“description”: “”, “fields”: {}}, “turn_off”: {“description”: “Stop the current cleaning task and return to home.”, “fields”: {“entity_id”: {“description”: “Name of the botvac entity.”, “example”: “vacuum.xiaomi_vacuum_cleaner”}}}, “turn_on”: {“description”: “Start a new cleaning task.”, “fields”: {“entity_id”: {“description”: “Name of the botvac entity.”, “example”: “vacuum.xiaomi_vacuum_cleaner”}}}, “xiaomi_remote_control_move”: {“description”: “Remote control the vacuum cleaner, make sure you first set it in remote control mode with remote_control_start.”, “fields”: {“duration”: {“description”: “Duration of the movement?”, “example”: “1500”}, “entity_id”: {“description”: “Name of the botvac entity.”, “example”: “vacuum.xiaomi_vacuum_cleaner”}, “rotation”: {“description”: “Rotation, between -179 degrees and 179 degrees.”, “example”: “90”}, “velocity”: {“description”: “Speed, between -0.29 and 0.29.”, “example”: “0.2”}}}, “xiaomi_remote_control_move_step”: {“description”: “Remote control the vacuum cleaner, only makes one move and then stops.”, “fields”: {“duration”: {“description”: “Duration of the movement?”, “example”: “1500”}, “entity_id”: {“description”: “Name of the botvac entity.”, “example”: “vacuum.xiaomi_vacuum_cleaner”}, “rotation”: {“description”: “Rotation, between -179 degrees and 179 degrees.”, “example”: “90”}, “velocity”: {“description”: “Speed, between -0.29 and 0.29.”, “example”: “0.2”}}}, “xiaomi_remote_control_start”: {“description”: “Start remote control of the vacuum cleaner. You can then move it with remote_control_move, when done call remote_control_stop.”, “fields”: {“entity_id”: {“description”: “Name of the botvac entity.”, “example”: “vacuum.xiaomi_vacuum_cleaner”}}}, “xiaomi_remote_control_stop”: {“description”: “Stop remote control mode of the vacuum cleaner.”, “fields”: {“entity_id”: {“description”: “Name of the botvac entity.”, “example”: “vacuum.xiaomi_vacuum_cleaner”}}}}}, {“domain”: “lock”, “services”: {“lock”: {“description”: “Lock all or specified locks”, “fields”: {“code”: {“description”: “An optional code to lock the lock with”, “example”: 1234}, “entity_id”: {“description”: “Name of lock to lock”, “example”: “lock.front_door”}}}, “nuki_lock_n_go”: {“description”: “Lock ‘n’ Go”, “fields”: {“entity_id”: {“description”: “Entity id of the Nuki lock”, “example”: “lock.front_door”}, “unlatch”: {“description”: “Whether to unlatch the lock”, “example”: false}}}, “nuki_unlatch”: {“description”: “Unlatch”, “fields”: {“entity_id”: {“description”: “Entity id of the Nuki lock”, “example”: “lock.front_door”}}}, “unlock”: {“description”: “Unlock all or specified locks”, “fields”: {“code”: {“description”: “An optional code to unlock the lock with”, “example”: 1234}, “entity_id”: {“description”: “Name of lock to unlock”, “example”: “lock.front_door”}}}}}, {“domain”: “tts”, “services”: {“clear_cache”: {“description”: “Remove cache files and RAM cache.”, “fields”: {}}, “google_say”: {“description”: “Say some things on a media player.”, “fields”: {“cache”: {“description”: “Control file cache of this message.”, “example”: “true”}, “entity_id”: {“description”: “Name(s) of media player entities.”, “example”: “media_player.floor”}, “language”: {“description”: “Language to use for speech generation.”, “example”: “ru”}, “message”: {“description”: “Text to speak on devices.”, “example”: “My name is hanna”}, “options”: {“description”: “A dictionary containing platform-specific options. Optional depending on the platform.”, “example”: “platform specific”}}}}}, {“domain”: “device_tracker”, “services”: {“see”: {“description”: “Control tracked device”, “fields”: {“battery”: {“description”: “Battery level of device”, “example”: “100”}, “dev_id”: {“description”: “Id of device (find id in known_devices.yaml)”, “example”: “phonedave”}, “gps”: {“description”: “GPS coordinates where device is located (latitude, longitude)”, “example”: “[51.509802, -0.086692]”}, “gps_accuracy”: {“description”: “Accuracy of GPS coordinates”, “example”: “80”}, “host_name”: {“description”: “Hostname of device”, “example”: “Dave”}, “location_name”: {“description”: “Name of location where device is located (not_home is away)”, “example”: “home”}, “mac”: {“description”: “MAC address of device”, “example”: “FF:FF:FF:FF:FF:FF”}}}}}, {“domain”: “hassio”, “services”: {“addon_restart”: {“description”: “”, “fields”: {}}, “addon_start”: {“description”: “”, “fields”: {}}, “addon_stdin”: {“description”: “”, “fields”: {}}, “addon_stop”: {“description”: “”, “fields”: {}}, “host_reboot”: {“description”: “”, “fields”: {}}, “host_shutdown”: {“description”: “”, “fields”: {}}}}, {“domain”: “apple_tv”, “services”: {“apple_tv_authenticate”: {“description”: “”, “fields”: {}}, “apple_tv_scan”: {“description”: “”, “fields”: {}}}}, {“domain”: “remote”, “services”: {“send_command”: {“description”: “Sends a single command to a single device”, “fields”: {“command”: {“description”: “A single command or a list of commands to send.”, “example”: “Play”}, “delay_secs”: {“description”: “An optional value that specifies that number of seconds you want to wait in between repeated commands. If not specified, the default of 0.4 seconds will be used”, “example”: “0.75”}, “device”: {“description”: “Device ID to send command to”, “example”: “32756745”}, “entity_id”: {“description”: “Name(s) of entities to send command from”, “example”: “remote.family_room”}, “num_repeats”: {“description”: “An optional value that specifies the number of times you want to repeat the command(s). If not specified, the command(s) will not be repeated”, “example”: “5”}}}, “toggle”: {“description”: “Toggles a device”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to toggle”, “example”: “remote.family_room”}}}, “turn_off”: {“description”: “Sends the Power Off Command”, “fields”: {“entity_id”: {“description”: “Name(s) of entities to turn off”, “example”: “remote.family_room”}}}, “turn_on”: {“description”: “Sends the Power On Command”, “fields”: {“activity”: {“description”: “Activity ID or Activity Name to start”, “example”: “BedroomTV”}, “entity_id”: {“description”: “Name(s) of entities to turn on”, “example”: “remote.family_room”}}}}}]

1 „Gefällt mir“