I want to add support for the Sinopé light switch and dimmer. I’m almost there but still having an error in the log:
2018-01-08 23:03:32 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
result = coro.send(None)
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 399, in async_process_entity
new_entity, self, update_before_add=update_before_add
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 247, in async_add_entity
yield from entity.async_update_ha_state()
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 210, in async_update_ha_state
state = self.state
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 360, in state
return STATE_ON if self.is_on else STATE_OFF
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 365, in is_on
raise NotImplementedError()
The error occur when I’m reading the switch state. Do I need to add code directly in HA ? in entity.py ?
Also I’ve created it as a switch component. Is it better to make it as a light component ?
I would add the component as a light for the dimmer since you need to set a brightness or intensity parameter. I only have the dimmer switches so I can’t confirm how you would want to add the switch only component. Feel free to DM me your code if you’d like a 2nd person testing.
Yes I’ve both. and also load controller. To be able to differentiate between all of them you will need to add: if device["info"]["type"] == 10:
where 10 is for thermostat TH1120RF, 3000W and 4000W
20 is for floor heating thermostat TH1300RF
21 is for low power thermostat TH1400RF 24v AC
102 is for light switch SW2500RF
112 is for dimmer switch DM2500RF
and 120 is for load controller RM3250RF and RM3200RF
if you have all of them in your home it will allow to control them separately with the appropriate module in HA.
Could you send me your code for dimmer. I’m able to see all my device but still have problem sending command for them.
I’ve added the code. Note that there is an issue with the sinope component and it not updating all the time. Your log file will get polluted. This is an issue that was being discussed here: Sinope Line Voltage Thermostats https://github.com/dj21d/sinope
I hope to have some more cycles to address the issue. Feel free to edit the code, this was my quick/first attempt at making a component
Is it included in the sinope.py file for the thermostat or it’s a separate file?
In sinope.py there is only type=10 which is for the thermostat. You should have type 102 and 112 for light et dimmer.
Ok I’ve installed your code and then on restart my log were flooded with error messages.
Then I’ve made a small change in your code:
DEFAULT_NAME = ‘Sinope dimmer’
I’ve changed the default name to have something different then what I have for the thermostat so now I have ‘Sinope’ for thermostat, ‘Sinope dimmer’ for the dimmer, ‘Sinope light’ for the light switch and ‘Sinope switch’ for the load controler.
DEFAULT_NAME should be different for each sinope module I think.
The log are quiet now but with your code I’m at the same place then what I have with my code. I’m able to read the dimmer, light or switch state (intensity) but I cannot close or open the dimmer. Each time I switch the slider to turn off one dimmer after few second there is a flag at the bottom of the screen that pop up and the slider goes back to it initial state. I can’t turn on or off the dimmer.
Also when a dimmer is on. If I click on it to open the popup history I notice that the slider at the bottom is only at 50 not 100%. Would it be better to use _intensity_pct because normally _intensity goes from 0 to 254 and _intensity_pct goes from 0 to 100 (intensity percentage). I give it a try and let you know.
I’ve also changed the class name to SinopeDimmer instead of SinopeLight because I already have that one for the sinope light switch
``
for id, device in sinope_data.data.items():
if device[“info”][“type”] == 112:
devices.append(SinopeDimmer(sinope_data, id, ‘{} {}’.format(name, device[“info”][“name”])))
Nice addition. I think my next project will be to break the hub out of it so that you so much overlapping code isn’t needed for the climate and light component.
The 50% intensity was just my code trying to say “If you don’t know what brightness you were before set the light to 50%” which is my preferred level. That should be changed though, since it’s not the best feature. I still need to get ahold of the Sinope api docs and see if I can find where they are saving the old intensity level of a light when it’s powered off. That would be the ideal method/value
Great find. I’ve modified my code a bit and pushed to github. The slider now works on the dashboard and it will now recall the old brightness if one is not set!
With your regular light switch what kind of call is it making for turning the light on/off? Is it still using intensity? Maybe we can add the required code to my repo for it. I’m hoping once we can make the hub and fix the failed call issues we can make a PR and officially add this.
I’m on Hassbian on Pi3. I just updated to 0.64.3 and nothing was working. I’ve updated hassbian and then it’s back again. Normally I update hasbian first and HA after but this time It was needing a second update of hassbian.
I’ll add the system monitor. Now both dimmer and light are working but not 100% of time. I’ll send you my code soon this week.
I’m a little busy now because my wife just came back from hospital for a hip replacement. Maybe some day I’ll be able to control her with HA
Ok I’m ready to send you my code for dimmer, light and power switch. For dimmer It’s almost the same as what you have except that I’ve changed float for int.
How can I send you my code. By email ?