Template Switch and Homematic Variable

Hello,

i’ve trying to get a template switch working with a homematic variable but i get a error, am i getting something wrong?

Template Switch:

- platform: template
  switches:
    alarmanlage:
      friendly_name: Alarmanlage
      value_template: "{{ is_state('binary_sensor.alarmanlage_var', 'on') }}"
      turn_on:
        service: homematic.set_variable_value
        data:
          entity_id: homemeatic.ccu2
          name: Alarmanlage
          value: 1
      turn_off:
        service: homematic.set_variable_value
        data:
          entity_id: homemeatic.ccu2
          name: Alarmanlage
          value: 0

Log:

e[32m2018-02-05 15:22:51 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=homeassistant, service=turn_on, service_data=entity_id=switch.alarmanlage, service_call_id=22691986098440-10>e[0m
e[32m2018-02-05 15:22:51 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=switch, service=turn_on, service_data=entity_id=['switch.alarmanlage'], service_call_id=22691986098440-11>e[0m
e[32m2018-02-05 15:22:51 INFO (MainThread) [homeassistant.helpers.script] Running scripte[0m
e[32m2018-02-05 15:22:51 INFO (MainThread) [homeassistant.helpers.script] Executing step call servicee[0m
e[32m2018-02-05 15:22:51 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=homematic, service=set_variable_value, service_data=entity_id=homemeatic.ccu2, name=Alarmanlage, value=1, service_call_id=22691986098440-12>e[0m
e[31m2018-02-05 15:22:51 ERROR (SyncWorker_68) [homeassistant.components.homematic] No HomeMatic hubs availablee[0m

The error indicates that there somehow is a problem with setting the variable. Does setting the variable via the Home Assistant GUI (/dev-service) give you the same error?

The error only appears if i try to switch the switch to on or off in the GUI of HA.

If i set the status like the picture below it works and the variable is written to the ccu2 (btw this is a old picture and i set it wit 0 and 1 instead of true and false), also got an automation running that sets antoher variable and this other automation work’s fine.

ba622641db19a3e563ab0f8e5e6592336aeb7932_1_445x500

@danielperna84 Am i configured something wrong? All variables and everything is correctly submitted from the CCU2 to HomeAssistant.

Unfortunately I can’t help at this point. If it’s working from the dev-site, then in general it’s working. To the problem must be something else not directly related to Homematic. But I don’t have much experience with templates or automations, so I don’t know what is causing your issue. :frowning:

hi @ich777 , I know, this post is older than 2 years… but i have the same problem … how did you solve it?

@reg
Actually I never solved this problem but now that you have digged out this thread I have to look at it again… :smiley:

Thx. Fyi. I found the bug last night. The description in the documentation is wrong: https://www.home-assistant.io/integrations/homematic/#examples

If you use service_data instead of data it works.

But I don’t know to whom I have to report this failure to to correct it… I changed the description in the page on GitHub, but how to proceed - we’ll see…