Did this work for you?
It seems that no matter what I do, I can only switch one device on.
For example, if I cut-and-paste the same format as you suggested, the second one of the three lights that I list will turn on, but not the other two. If I simply swap them and try again, whichever falls in second will turn on, but still not the others.
I have also created groups, scenes, etc… I can never get multiple entities to turn on.
By the way… they are all of the same type.
Well… That much I know (i.e. basic stuff & something else is wrong). The question is: what?
I have tried everything, but again a simple automation (i.e. in the automation.yaml) such as:
- id: '1510464937408'
alias: Bedroom at Night
trigger:
- platform: time
at: '23:30'
condition: []
action:
- service: light.turn_off
data:
entity_id: light.bedroom_light
- service: light.turn_on
data:
entity_id: light.bedroom_fan
works fine. But if I change “off” to “on” in the first service line, it won’t work anymore.
I had tried that before (but did it again, just in case). Same difference: only the fan goes on. Also, with this structure, I can only turn “on” or turn “off” everything (and hence, it never works). With my original structure (above), I can make one “off” and the other “on” and that is the only case that two services will work. (i.e. with my code, “off” and “on” works, but “on” and “on” or even “on” and “off” won’t work).
Here are my config/auto .yaml files if anyone wants to take a look.
##configuration.yaml
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: 38.9517
longitude: 92.3341
# Impacts weather/sunrise data (altitude above sea level in meters)
elevation: 274
# metric for Metric, imperial for Imperial
unit_system: imperial
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: America/Chicago
# Show links to resources in log and frontend
introduction:
# Enables the frontend
frontend:
# Enables configuration UI
config:
http:
# 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:
# Track the sun
sun:
# Text to speech
tts:
platform: google
automation: !include automations.yaml
hue:
bridges:
- host: 10.14.1.58
filename: phue.conf
allow_unreachable: true
allow_hue_groups: true
##automation.yaml
- id: '1510464937408'
alias: Bedroom at Night
trigger:
platform: time
at: '23:30:00'
action:
service: light.turn_on
entity_id:
- light.bedroom_light
- light.bedroom_fan
I had done that too. But did it again. Same behavior, except that I have just noticed that with “light.turn_on”, it is the bedroom_fan (second one) that goes on, but with homeassistant.turn_on it is the bedroom_light (first one) that goes on.
Hey! I think I have a corrupted script. Could you please send me your:/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py file?
I have just noticed this error while turning on/off bedroom_fan:
Thu Dec 27 2018 10:46:37 GMT-0600 (Central Standard Time)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 277, in _handle_service_platform_call
await getattr(entity, func)(**data)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/light/hue.py", line 388, in async_turn_off
await self.light.set_state(**command)
File "/srv/homeassistant/lib/python3.6/site-packages/aiohue/lights.py", line 75, in set_state
json=data)
File "/srv/homeassistant/lib/python3.6/site-packages/aiohue/bridge.py", line 64, in request
data = await res.json()
File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/client_reqrep.py", line 947, in json
return loads(stripped.decode(encoding))
File "/usr/local/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 81 (char 80)
Just FYI… reinstalling didn’t work. It seems that the json responses from the HABridge are not being correctly decoded by HomeAssistant.
It is weird because I can’t find any other related bug reports around. So, it may be some wrong setting that is very rare, and I was “lucky” to have picked that.
I solved the problem by adding the code below to line 947 of /srv/homeassistant/lib/python3.6/site-packages/aiohttp/client_reqrep.py
Now multiple service, actions, group of devices… everything that wasn’t working is now working.
### GND ADDED LINES FROM HERE TO "ORIGINAL" BELOW
while True:
try:
return loads(stripped.decode(encoding))
break
except ValueError:
print("Oops! GND: Captured error ...")
return None
except:
print("Oops! GND: Non-Captured error ...")
return None
### GND ORIGNAL LINE return loads(stripped.decode(encoding))