Hi.
A newbie wondering how I’d achieve my goals:
I’d like to automatically cycle waterpump every 4 hours for ex. 3 minutes, turn lights on every morning and turn lights off every evening using esp12e.
Switches are working just fine, but I can’t get automation part working, could someone give a hand here?
My configuration syntax seems right, but it doesn’t work, no automated data is passed, even when trigger by hand.
When I use manual switches, I get “PUMP ON” and “LIGHT ON” in Arduino IDE serial console wich is attached to esp12e,
they are working just fine.
Automated part is not, I just noticed in logbook “Waterpump controller has been triggered” hourly, but no messages in Arduino IDE serial console.
Is the broker running and is the esp connected to the broker?
Can you manually post a mqtt message to the esp and see a result? You can use the command line to send a message. mosquitto_pub -t ‘ha/light’ -m ‘ON’ should turn the light on?
I saw something else both of your switches have a mistake at the end … . it may just be the way you formatted them for the forum but …
optimistic:
false retain: true
should be ....
optimistic: false
retain: true
Light and pump are not attached to esp12e atm, but “mosquitto_pub -t ‘ha/light’ -m ‘ON’'” and “mosquitto_pub -t ‘ha/pump’ -m ‘ON’” should work at hardware level, because I get response to serial monitor.
I’ll check issue You mentioned, but I think it’s because way formatted in forum… (EDIT: This was right in configuration file, my mistake during posting to forum)
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: 60.2257
longitude: 24.8636
# Impacts weather/sunrise data (altitude above sea level in meters)
elevation: 20
# 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: Europe/Helsinki
# Show links to resources in log and frontend
introduction:
# Enables the frontend
frontend:
# Enables configuration UI
config:
http:
# Uncomment this to add a password (recommended!)
# api_password: PASSWORD
# Uncomment this if you are using SSL or running in Docker etc
# base_url: example.duckdns.org:8123
# Checks for available updates
updater:
# 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:
# Track the sun
sun:
# Weather Prediction
sensor:
platform: yr
# Text to speech
tts:
platform: google
group: !include groups.yaml
device_tracker:
- platform: ddwrt
host: 192.168.1.2
username: user
password: pass
interval_seconds: 10
consider_home: 180
track_new_devices: yes
- platform: bluetooth_tracker
mqtt:
broker: 192.168.1.13
port: 1883
client_id: home-assistant
username: user
password: pass
keepalive: 60
protocol: 3.1.1
switch ebbpump:
platform: mqtt
name: 'EBB Pump'
state_topic: 'ha/pump'
command_topic: 'ha/pump'
qos: 0
payload_on: "ON"
payload_off: "OFF"
optimistic: false
retain: true
automation ebbpump:
alias: 'Waterpump controller'
trigger:
platform: time
hours: '/4'
minutes: 00
seconds: 00
action:
service: homeassistant.turn_on
entity_id: switch.ebbpump
switch ebblight:
platform: mqtt
name: 'EBB Light'
state_topic: 'ha/light'
command_topic: 'ha/light'
qos: 0
payload_on: "ON"
payload_off: "OFF"
optimistic: false
retain: true
automation ebblight_on:
alias: 'Light ON timer'
trigger:
platform: time
after: '08:00:00'
action:
service: homeassistant.turn_on
entity_id: switch.ebblight
automation ebblight_off:
alias: 'Light OFF timer'
trigger:
platform: time
after: '20:59:59'
action:
service: homeassistant.turn_off
entity_id: switch.ebblight
sensor ebbtemp:
platform: mqtt
name: "EBB Temperature"
state_topic: "sensor/temperature"
qos: 0
unit_of_measurement: "ºC"
sensor ebbhumi:
platform: mqtt
name: "EBB Humidity"
state_topic: "sensor/humidity"
qos: 0
unit_of_measurement: "%"
sensor outtemp:
platform: mqtt
name: "Outside"
state_topic: "sensor/temperature1"
qos: 0
unit_of_measurement: "ºC"
sensor outhumi:
platform: mqtt
name: "Outside"
state_topic: "sensor/humidity1"
qos: 0
unit_of_measurement: "%"
sensor outrealfeel:
platform: mqtt
name: "Outside"
state_topic: "sensor/realfeel1"
qos: 0
unit_of_measurement: "%"
logger:
default: warning
logs:
homeassistant.components.device_tracker.mqtt: debug
Sensors are not working right now, I have issue with arduino code, trying to solve it too.
HA is running at Raspberry Pi 2, HA version is 0.40.2 Hassbian.
When I use manual EBB Light switch, I get response from esp12 to serial console.
Logbook tells me: Light ON timer has been triggered,
but serial console doesn’t show anything…
On arduino code I have water level sensor, wich cuts water pump operation when water level is low in tank,
how I could send a response to HA if water level was too low when pump was triggered?
Thanks for posting your config
I can’t see anything wrong with the config, it’s pretty much exactly the same as mine. Have you tried manually posting a mqtt message to the adruino using a putty console (at the HA side ie. mqtt broker side), something like this…
This will test that you are communicating with the adruino via mqtt. Hopefully the light will come on or at least the serial console will show the result? Things to investigate, are you using the same case on both sides? (ON or on) and are you publishing/subscribing to the correct topics (ha/light or ha/pump note all lower case) on both sides?
I tend to split my command topic and state topic …
It just makes it easier to see where the messages are going to or coming from. The other thing to make sure of is leading “/” at the adruino end, so ‘ha/light’ is a different address to ‘/ha/light’.
As for the pump I assume you have a way of monitoring the water level, so I would check what level it is before triggering the pump and then send an appropriate mqtt message to HA.
Does this mean you can change the switches on the HA page and the pump turns on and off? This would mean that the MQTT is working fine and its the automation yaml that is wrong.
OK, have you tried manually triggering the automation from the automation card in the front-end, you have to click on the automation line then click the trigger, that should have the same effect as manually clicking the switch in the front end, since it bypasses the automation trigger. That will eliminate the actual turn on/off part of the automation. You can’t click the automation switch as that just turns the automation off/on.