th1234
February 21, 2020, 2:47pm
1
Hello,
I created a slider temperature with shell command for AC and I created an autmation. When I moved the slider I saw that the automation triggered but I created a file to test if the input data is written in the file but nothing happened.
it’s the configuration.yaml:
input_number:
ac_temperature:
name: A/C Setting
initial: 24
min: 18
max: 32
step: 1
shell_command:
set_ac_to_slider: echo {{ states("input_number.ac_temperature") }} > /home/docker/homeassistant/hass_config/kuku.txt
And it’s the automations.yaml file:
- id: 'ac_config'
alias: 'Apply A/C Configuration'
trigger:
platform: state
entity_id: input_number.ac_temperature
action:
service: shell_command.set_ac_to_slider
What I am doing wrong?
Thanks
tom_l
February 21, 2020, 3:18pm
2
You could try using the file notification service instead.
tom_l
February 21, 2020, 3:57pm
6
Do you have permission to write to /home/docker/homeassistant/hass_config/
?
th1234
February 21, 2020, 5:06pm
7
yes i have.
I think that the problem is in the way I am writing the shell command.
tom_l
February 21, 2020, 5:55pm
8
Not if the file notification service didn’t work either. That works for me. Any related errors in the log?
Have you tried quoting the shell command?
shell_command:
set_ac_to_slider: 'echo {{ states("input_number.ac_temperature") }} > /home/docker/homeassistant/hass_config/kuku.txt'
th1234
February 21, 2020, 6:56pm
9
Where is the log file?
How I can use the file notification service? I have to delete the shell_command and add this:
# Example configuration.yaml entry
sensor:
- platform: file
name: Temperature
file_path: /home/user/.homeassistant/sensor.json
value_template: '{{ value_json.temperature }}'
unit_of_measurement: '°C'
Or I have to add this instead:
# Example configuration.yaml entry
notify:
- name: NOTIFIER_NAME
platform: file
filename: FILENAME
tom_l
February 21, 2020, 7:09pm
10
Add the notification service with the correct file path.
Then instead of calling your shell command call the notification service instead.
th1234
February 21, 2020, 7:11pm
11
How I read the data from the slider in the notification service?
There are only 3 parameters in the notification: name, platform and file name
tom_l
February 21, 2020, 7:12pm
12
You don’t put it in the notification service config. When you call the notification service you put your sensor state template in the message.
Also the log is in the developer tools.
th1234
February 21, 2020, 7:17pm
13
After I put the notification service, the configuration.yaml looks like this:
input_number:
ac_temperature:
name: A/C Setting
initial: 24
min: 18
max: 32
step: 1
# Example configuration.yaml entry
notify:
- name: AC tempertaure notification
platform: file
filename: AC
What I have to add to the configuartion.yaml file?
Do I have to change something in the automations.yaml?
tom_l
February 21, 2020, 8:56pm
14
First you should specify a path for the file In the notification config then change your automation to:
- id: 'ac_config'
alias: 'Apply A/C Configuration'
trigger:
platform: state
entity_id: input_number.ac_temperature
action:
service: notify.ac_temperature_notification
data_template:
message: '{{ states("input_number.ac_temperature") }}'
th1234
February 21, 2020, 8:59pm
15
Where i should specify a path? I have to add file_path parameter? Or in the filename?
tom_l
February 21, 2020, 9:04pm
16
As there is no file_path parameter it has to be the file_name. But leave it for now and just look for the file in your configuration folder.
th1234
February 21, 2020, 9:14pm
17
I tried without specify a path and nothing happened
tom_l
February 22, 2020, 10:12am
18
Check that this entity id is correct in the developer tools states menu:
notify.ac_temperature_notification
th1234
February 24, 2020, 11:01pm
19
Thank you, It worked for me.
Now I have another question: I want to send in mqtt , messages with codes of my air conditioner. I want that the codes that I am sending will be like the temperature in the slider that I created. How can I do this?
For example, I have the codes of 16 celsius temp for my air conditiner but its a lot of codes that I have to send. I want that when I put the slider on 16, It will send the right code.
tom_l
February 25, 2020, 4:16am
20
You need to map the values of your slider to the codes then send the mapped codes in a template in the mqtt publish service. Have a read of this topic for some ideas about mapping values:
HI,
for a Hue setup, I need to set sensor Ids in the code, but for the frontend I want the humanely understandable names of these sensors in the input_select. I need to map these values:
input_select:
select_hue_motion_sensor:
name: Select motion sensor
options:
- 5
- 7
- 12
- 22
- 28
- 33
- etc
to read like:
input_select:
select_hue_motion_sensor:
name: Select motion sensor
options:
- Corridor
- Corridor terrace
- Master bedroom
- Cor…