Hi
I am trying to control some Telldus Live switches in Home Assistant form a Fibaro Home Center 2 with LUA scripting. When I look in the Web GUI of Home Assistant I can see that the switch changes state, but it changes back after about 5 seconds. I have noticed that the switch changes the normal “flash” to an on/off slider during these 5 seconds just to change back to the “flash” again.
This is the LUA code I use in my Fibaro:
local thisdevice = fibaro:getSelfId()
local ip = fibaro:getValue(thisdevice, 'IPAddress')
local port = fibaro:getValue(thisdevice, 'TCPPort')
local httpSession = Net.FHttp(ip, port);
jsonTable = { state = "off" }
jsonString = json.encode(jsonTable)
response, status, errorCode = httpSession:PUT('/api/states/switch.garage_motorvrmare', jsonString)
fibaro:debug("Response = "..response)
fibaro:debug("Status = "..status)
fibaro:debug("ErrorCode = "..errorCode)
Log Entry:
16-05-06 12:18:00
homeassistant.components.device_tracker.tomato.Tomato: Scanning
16-05-06 12:18:00
requests.packages.urllib3.connectionpool: Starting new HTTP connection (1):
192.168.1.1
16-05-06 12:18:02 homeassistant.core: Bus:Handling
<Event state_changed[L]: new_state=<state switch.garage_motorvrmare=off @
2016-05-06T12:18:02.581450+02:00>, entity_id=switch.garage_motorvrmare,
old_state=<state switch.garage_motorvrmare=on; friendly_name=Garage:
Motorvärmare, assumed_state=True @ 2016-05-06T12:16:30.506960+02:00>>
16-05-06 12:18:02 homeassistant.components.http:
"PUT /api/states/switch.garage_motorvrmare HTTP/1.1" 200 -
16-05-06 12:18:00 requests.packages.urllib3.connectionpool:
Starting new HTTP connection (1): 192.168.1.1
16-05-06 12:18:02 homeassistant.core: Bus:Handling
<Event state_changed[L]: new_state=<state switch.garage_motorvrmare=off @
2016-05-06T12:18:02.581450+02:00>, entity_id=switch.garage_motorvrmare,
old_state=<state switch.garage_motorvrmare=on; friendly_name=Garage:
Motorvärmare, assumed_state=True @ 2016-05-06T12:16:30.506960+02:00>>
16-05-06 12:18:02 homeassistant.components.http:
"PUT /api/states/switch.garage_motorvrmare HTTP/1.1" 200 -
16-05-06 12:18:02 homeassistant.core: Bus:Handling
<Event state_changed[L]: new_state=<state group.all_switches=off;
hidden=True, friendly_name=all switches, order=1, auto=True,
entity_id=('switch.hall_macro_dimmer', 'switch.sovrum_fnster', 'switch.garage_motorvrmare',
'switch.hall_sknk_vgguttag', 'switch.vardagsrum_vinstll_och_fglar',
'switch.biorum_bord_vgguttag', 'switch.utehumlebge', 'switch.tvttstuga_fnster',
'switch.hall_dimmer_tak', 'switch.hall_julgran_vgguttag',
'switch.gstrum_fnster_vgguttag', 'switch.sovrum_kattas_snglampa',
'switch.bl_rum_fnster_vgguttag', 'switch.vardagsrum_byr_och_tv',
'switch.hall_fnster', 'switch.trappa', 'switch.ute_trd', 'switch.sovrum_flkt',
'switch.vardagsrum_bursprk'), assumed_state=True @
2016-05-06T12:18:02.584347+02:00>, entity_id=group.all_switches,
old_state=<state group.all_switches=on; hidden=True, friendly_name=all
switches, order=1, auto=True, entity_id=('switch.hall_macro_dimmer',
'switch.sovrum_fnster', 'switch.garage_motorvrmare', 'switch.hall_sknk_vgguttag',
'switch.vardagsrum_vinstll_och_fglar', 'switch.biorum_bord_vgguttag',
'switch.utehumlebge', 'switch.tvttstuga_fnster', 'switch.hall_dimmer_tak',
'switch.hall_julgran_vgguttag', 'switch.gstrum_fnster_vgguttag',
'switch.sovrum_kattas_snglampa', 'switch.bl_rum_fnster_vgguttag',
'switch.vardagsrum_byr_och_tv', 'switch.hall_fnster', 'switch.trappa',
'switch.ute_trd', 'switch.sovrum_flkt', 'switch.vardagsrum_bursprk'),
assumed_state=True @ 2016-05-06T12:16:30.545694+02:00>>
16-05-06 12:18:09 netdisco.ssdp: Error fetching
description at http://172.16.1.10:50000/rootDesc.xml
16-05-06 12:18:09
requests.packages.urllib3.connectionpool: Starting new HTTP connection (1):
192.168.1.10
16-05-06 12:18:30 homeassistant.core: Bus:Handling
<Event state_changed[L]: new_state=<state sun.sun=above_horizon;
next_rising=2016-05-07T02:29:44+00:00, elevation=46.56,
next_setting=2016-05-06T18:59:51+00:00, friendly_name=Sun @
2016-05-06T12:15:40.565420+02:00>, entity_id=sun.sun, old_state=<state
sun.sun=above_horizon; next_rising=2016-05-07T02:29:44+00:00, elevation=46.54,
next_setting=2016-05-06T18:59:51+00:00, friendly_name=Sun @
2016-05-06T12:15:40.565420+02:00>>
16-05-06 12:18:30 homeassistant.core: Bus:Handling
<Event state_changed[L]: new_state=<state switch.garage_motorvrmare=on; friendly_name=Garage:
Motorvärmare, assumed_state=True @ 2016-05-06T12:18:30.678069+02:00>,
entity_id=switch.garage_motorvrmare, old_state=<state
switch.garage_motorvrmare=off @ 2016-05-06T12:18:02.581450+02:00>>
16-05-06
12:18:30 homeassistant.core: Bus:Handling <Event state_changed[L]:
new_state=<state group.all_switches=on; hidden=True, friendly_name=all
switches, order=1, auto=True, entity_id=('switch.hall_macro_dimmer',
'switch.sovrum_fnster', 'switch.garage_motorvrmare', 'switch.hall_sknk_vgguttag',
'switch.vardagsrum_vinstll_och_fglar', 'switch.biorum_bord_vgguttag',
'switch.utehumlebge', 'switch.tvttstuga_fnster', 'switch.hall_dimmer_tak',
'switch.hall_julgran_vgguttag', 'switch.gstrum_fnster_vgguttag',
'switch.sovrum_kattas_snglampa', 'switch.bl_rum_fnster_vgguttag',
'switch.vardagsrum_byr_och_tv', 'switch.hall_fnster', 'switch.trappa',
'switch.ute_trd', 'switch.sovrum_flkt', 'switch.vardagsrum_bursprk'),
assumed_state=True @ 2016-05-06T12:18:30.681804+02:00>,
entity_id=group.all_switches, old_state=<state group.all_switches=off;
hidden=True, friendly_name=all switches, order=1, auto=True,
entity_id=('switch.hall_macro_dimmer', 'switch.sovrum_fnster',
'switch.garage_motorvrmare', 'switch.hall_sknk_vgguttag',
'switch.vardagsrum_vinstll_och_fglar', 'switch.biorum_bord_vgguttag',
'switch.utehumlebge', 'switch.tvttstuga_fnster', 'switch.hall_dimmer_tak',
'switch.hall_julgran_vgguttag', 'switch.gstrum_fnster_vgguttag',
'switch.sovrum_kattas_snglampa', 'switch.bl_rum_fnster_vgguttag',
'switch.vardagsrum_byr_och_tv', 'switch.hall_fnster', 'switch.trappa',
'switch.ute_trd', 'switch.sovrum_flkt', 'switch.vardagsrum_bursprk'),
assumed_state=True @ 2016-05-06T12:18:02.584347+02:00>>
Any ideas on what I am doing wrong?