It didn’t work
Do you have permission to write to /home/docker/homeassistant/hass_config/
?
yes i have.
I think that the problem is in the way I am writing the shell command.
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'
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
Add the notification service with the correct file path.
Then instead of calling your shell command call the notification service instead.
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
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.
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?
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") }}'
Where i should specify a path? I have to add file_path parameter? Or in the filename?
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.
I tried without specify a path and nothing happened
Check that this entity id is correct in the developer tools states menu:
notify.ac_temperature_notification
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.
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:
Can I map values for an input_number or just for input_select?
Yes you can use an input number. You can map anything with discrete states. You will have 15 states to map: 18, 19, 20, … 32.
thank you!
Can you help me?
I tried to map but I didn’t success.
For example, it is the code for temperature 18 celsius: “0,8984,4500,616,592,616,592,612,1696,616,1692,612,596,612,592,640,1668,640,568,
616,592,612,596,636,568,616,592,616,592,612,592,616,592,612,596,612,592,612,
596,612,596,612,592,616,592,612,1696,616,1692,612,596,612,592,616,592,616,
592,612,596,612,1696,612,592,616,1692,612,596,612,596,612,1696,612,592,616,
20032,640,1668,640,568,612,592,616,592,616,592,612,596,612,592,616,592,616,
592,612,592,616,592,612,596,612,592,616,592,616,592,612,596,612,592,616,592,
616,592,612,592,616,592,612,596,612,596,612,592,616,592,612,596,612,592,616,
592,616,592,612,1696,612,1696,612,596,612”.
How I map this?