Thanks guys.
I solved this by using the Google Assistant Webserver addon in Hassio, which you can send HTTP requests to being translated to Google Home commands. Im sending the http requests by creating command line switches:
switch:
platform: command_line
switches:
taklampa_vardagsrummet_google_home:
command_on: "/usr/bin/curl -X GET http://192.168.0.6:15555/command?message=turn%20on%20big%20ceiling%20lamp"
command_off: "/usr/bin/curl -X GET http://192.168.0.6:15555/command?message=turn%20off%20big%20ceiling%20lamp"
friendly_name: Taklampan i Vardagsrummet (Ceiling lamp living room)
taklampa_hallen_dorrlampan_google_home:
command_on: "/usr/bin/curl -X GET http://192.168.0.6:15555/command?message=turn%20on%20door%20light"
command_off: "/usr/bin/curl -X GET http://192.168.0.6:15555/command?message=turn%20off%20door%20light"
friendly_name: Dörrlampan i Hallen (Door lamp in the hallway)
Then I created an input_boolean for each lamp:
input_boolean:
emu_taklampa_kontoret:
name: Taklampan på Kontoret
initial: off
emu_taklampa_vardagsrummet:
name: Taklampa i Vardagsrummet
initial: off
emu_taklampa_dorren:
name: Dörrlampan i Hallen
initial: off
And then put (for each lamp) the input_boolean together with the switch for each google home call into a group, which I can then add to various Lovelace cards for example.
group:
taklampa_vardagsrum_emulerad:
name: “Taklampa Vardagsrum”
entities:
- input_boolean.emu_taklampa_vardagsrummet #Emulerad lampa
- switch.taklampa_vardagsrummet_google_home #Emulerad Switch med Google Home assistans
taklampa_dorrlampan_emulerad:
name: “Dörrlampan”
entities:
- input_boolean.emu_taklampa_dorren #Emulerad lampa
- switch.taklampa_hallen_dorrlampan_google_home #Emulerad Switch med Google Home assistans
Now, to add this to a picture entity card in ui-lovelace.yaml, I have these lines (for each lamp) to switch on and off the lamps, and the input_boolean keeps remembering which states the lamps has (on or off). By clicking the picture entity, Im doing a trigger action. I also added a turn-off action when I press on the image for a second, using the hold_action. Here is an example:
ui-lovelace.yaml
- entity: input_boolean.emu_taklampa_vardagsrummet
image: /local/click_hover.png
style:
left: 49%
top: 41%
width: 12%
tap_action:
action: call-service
service: homeassistant.toggle
title: Taklampan i Vardagsrummet
service_data:
entity_id:
- input_boolean.emu_taklampa_vardagsrummet
- switch.taklampa_vardagsrummet_google_home
hold_action:
action: call-service
service: homeassistant.turn_off
title: Taklampan i Vardagsrummet
service_data:
entity_id:
- input_boolean.emu_taklampa_vardagsrummet
- switch.taklampa_vardagsrummet_google_home
type: image
title: Taklampan i Vardagsrummet
Its all quite easy to make working, but it took me a few days to understand the whole process, as Im quite new to HA in general.
I will add my full code maybe later this week.
Thanks again!