Im trying to control my roller curtain. I have it set up so that if it receives a 1 or 0, it activates the dc motor in one direction or another. If I add value of 1 it fails but if I add value of 0 it works:
You need data_template instead of data any time you use a template in your data.
So everywhere you have a block with {{}} inside the data block, you need to change data to data_template.
Please be informed that you can probably also use a template switch instead of writing multiple automations.
The command_topic should be the topic that opens/closes the curtains when a command is sent to it. The state_topic should be the topic that shows the state of the curtains.
When the switch works, it will send “1” to the command_topic when you turn on the switch and send “0” to the command_topic when you turn off the switch. The switch gets its state from the state_topic.
I also realized your templates don’t make sense, currently it sends the state of the input_boolean as a payload, however you need 1 or 0 as payload, the state of an input_boolean is either ‘on’ or ‘off’, so it will not send the correct payload and therefore your curtain wont change position.
Yeah I dont understand what happened. With all the versions things have gotten messed up. When I started, automations.yaml didnt exist, at least I dont think so or maybe I didnt use it. What I know so far is that the switch doesnt show up for the curtains as it does for the solenoid and kompressor and I dont understand why?
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: 25.5263
longitude: -58.0307
# Impacts weather/sunrise data (altitude above sea level in meters)
elevation: 90
# metric for Metric, imperial for Imperial
unit_system: metric
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: America/Bogota
# Customization file
customize: !include customize.yaml
# Show links to resources in log and frontend
#introduction:
# Enables the frontend
frontend:
# Enables configuration UI
config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
# Optional, allows Home Assistant developers to focus on popular components.
# include_used_components: true
# Discover some devices automatically
discovery:
# Allows you to issue voice commands from the frontend in enabled browsers
conversation:
# Enables support for tracking state changes over time
history:
# View all events in a logbook
logbook:
# Enables a map showing the location of tracked devices
map:
# Track the sun
sun:
# Example configuration.yaml entry
input_boolean:
notify_home:
name: Publish MQTT msg
icon: mdi:car
power_kompressor:
name: Kompressor
icon: mdi:car
power_solenoid:
name: Solenoid
icon: mdi:car
power_curtain:
name: Curtains
icon: mdi:home
# MQTT Switches RPi2 - RPi3
switch:
- platform: mqtt
name: kompressor
command_topic: "test_channel"
payload_on: "komp-on"
payload_off: "komp-off"
- platform: mqtt
name: solenoid
command_topic: "test_channel"
payload_on: "sole-on"
payload_off: "sole-off"
- platform: mqtt
name: power_curtain
command_topic: "curtainStatus"
payload_on: "1"
payload_off: "0"
# Sensors
sensor:
# Weather prediction
- platform: yr
# Emoncms
- platform: emoncms
api_key: mykey
url: http://www.mydomain.com/emoncms/
id: 1
# Example configuration.yaml entry configuring HomeKit
homekit:
mqtt:
broker: 192.168.1.113
sonoff:
username: [email protected]
password: mypwd
scan_interval: 60
grace_period: 600
api_region: 'us'
# Example configuration.yaml entry
device_tracker:
- platform: bluetooth_le_tracker
# Text to speech
tts:
- platform: google_translate
service_name: google_say
# Cloud
cloud:
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
#panel_iframe:
# configurator:
# title: Configurator
# icon: mdi:wrench
# url: http://hassio.local:3218
#
system_health:
Are you sure the topic is correct?
Can you please go to Developer Tools -> MQTT and enter # in the box “Listen to a topic” and press start listening. Then manually control the curtain and post a screenshot of the output in the “Listen to a topic” box here.
Did you restart Home Assistant after adding the switch?
If you go to Developer Tools -> States do you see an entity switch.power_curtain?
I changed the power_curtain command_topic to “test_channel” and after restarting, woah…a bunch of stuff changed. Not sure if it was because of the test_channel change. Let me try changing it back…
The only thing i did differently this time was that i found an option to Restart Hass in a sprocket wheel on the top left of the Configurator file editor and used that instead of the typical Restart Server option in the Hassio Configuration menu option…
ok so i changed it back to curtainStatus and it still shows up. So Im guessing this option: