I’m trying to use the shell command with an input select, to change the predefined heat programs of my Buderus central heating unit. The Buders KM271 serial board is configured with a stand alone FHEM instance, where i can send commands via telnet to.
So what I want to do is, to pass the input select value to the shell command and use the value to chance the heat program and use an automation to trigger the service.
- action:
- service: shell_command.set_heatprogramm
alias: run_set_heatprogramm
condition:
id: ‘1510046601796’
trigger:
- entity_id: input_select.heatprogramm_select
platform: state
To change the FHEM values via telnet I use netcat (nc) to send the commands to FHEM, but I have no idea how to escape the state of the input select so thats inside the command line.
shell_command:
set_heatprogramm: ‘echo “set Buderus hk1_programm {{ states.input_select.heatprogramm_select.state }}” | nc 192.168.x.x 7072’
Due to the fact that i have to use " to send the whole set … string to fhem with netcat i have to include the input select state in which kind of formatting?
Logfile after selection:
2017-11-07 11:09:53 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_data=option=frueh, entity_id=input_select.heatprogramm_select, service=select_option, service_call_id=1973120752-35, domain=input_select>
2017-11-07 11:09:53 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=<state input_select.heatprogramm_select=mittag; friendly_name=Heizprogramm, options=[‘eigen’, ‘familie’, ‘frueh’, ‘mittag’, ‘nachmittag’, ‘senior’, ‘single’, ‘spaet’, ‘vormittag’] @ 2017-11-07T10:46:59.973644+01:00>, entity_id=input_select.heatprogramm_select, new_state=<state input_select.heatprogramm_select=frueh; friendly_name=Heizprogramm, options=[‘eigen’, ‘familie’, ‘frueh’, ‘mittag’, ‘nachmittag’, ‘senior’, ‘single’, ‘spaet’, ‘vormittag’] @ 2017-11-07T11:09:53.275219+01:00>>
2017-11-07 11:09:53 INFO (MainThread) [homeassistant.components.automation] Executing run_set_heatprogramm
2017-11-07 11:09:53 INFO (MainThread) [homeassistant.core] Bus:Handling <Event logbook_entry[L]: message=has been triggered, name=run_set_heatprogramm, domain=automation, entity_id=automation.run_set_heatprogramm>
2017-11-07 11:09:53 INFO (MainThread) [homeassistant.helpers.script] Script run_set_heatprogramm: Running script
2017-11-07 11:09:53 INFO (MainThread) [homeassistant.helpers.script] Script run_set_heatprogramm: Executing step call service
2017-11-07 11:09:53 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_data=, service=set_heatprogramm, service_call_id=1973120752-36, domain=shell_command>
2017-11-07 11:09:53 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1973120752-35>
2017-11-07 11:09:53 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1973120752-36>
2017-11-07 11:09:53 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=<state automation.run_set_heatprogramm=on; friendly_name=run_set_heatprogramm, id=1510046601796, last_triggered=2017-11-07T10:47:00.068473+01:00 @ 2017-11-07T10:23:24.406207+01:00>, entity_id=automation.run_set_heatprogramm, new_state=<state automation.run_set_heatprogramm=on; friendly_name=run_set_heatprogramm, id=1510046601796, last_triggered=2017-11-07T11:09:53.357611+01:00 @ 2017-11-07T10:23:24.406207+01:00>>