Closed Gibletron closed 4 years ago
Please post http://device_ip/status and CoAP debug messages.
Simone
status:
{"wifi_sta":{"connected":true,"ssid":"MY-SSID","ip":"DEVICE-IP","rssi":-46},"cloud":{"enabled":false,"connected":false},"mqtt":{"connected":false},"time":"21:49","unixtime":1592689756,"serial":1,"has_update":false,"mac":"DEVICE-MAC","lights":[{"ison":true,"has_timer":false,"timer_started":0,"timer_duration":0,"timer_remaining":0,"mode":"white","brightness":60}],"meters":[{"power":2.77, "is_valid":true, "timestamp":1592689756,"counters":[2.768, 1.541, 0.542],"total":148}],"inputs":[{"input":1,"event":"L","event_cnt":44},{"input":0,"event":"","event_cnt":0}],"tmp":{"tC":53.40,"tF":128.12, "is_valid":true},"calib_progress":100,"calib_status":0,"wire_mode":1,"loaderror":0,"overtemperature":false,"overload":false,"update":{"status":"idle","has_update":false,"new_version":"20200615-133340/v1.7.2@e39e9c86","old_version":"20200615-133340/v1.7.2@e39e9c86"},"ram_total":47976,"ram_free":36816,"ram_lwm":28352,"fs_size":233681,"fs_free":120480,"uptime":5533}
As for the COaP Debug, I might not have the correct log, if that's the case, please send me in the right direction, but this is what I found:
2020-06-20 21:53:42 DEBUG (CoAP) [pyShelly] CoAP msg: DEVICE-IP b'PE\x00\n\xed\x0b\xf7\x08SHDM-2#DEVICE-MAC#1\xff{"blk":[{"I":0,"D":"Dimmer"}],"sen":[{"I":111,"T":"S","D":"Brightness","R":"0/100","L":0},{"I":121,"T":"S","D":"State","R":"0/1","L":0},{"I":131,"T":"S","D":"Input","R":"0(off)/1(on)/2(longpush)","L":0},{"I":141,"T":"S","D":"Input","R":"0(off)/1(on)/2(longpush)","L":0},{"I":211,"T":"S","D":"Energy counter 0 [W-min]","L":0},{"I":212,"T":"S","D":"Energy counter 1 [W-min]","L":0},{"I":213,"T":"S","D":"Energy counter 2 [W-min]","L":0},{"I":214,"T":"S","D":"Energy counter total [W-min]","L":0},{"I":311,"T":"T","D":"Temperature C","R":"-40/300","L":0},{"I":312,"T":"T","D":"Temperature F","R":"-40/300","L":0},{"I":313,"T":"S","D":"Overtemp","R":"0/1","L":0}]}' 2020-06-20 21:53:42 DEBUG (CoAP) [pyShelly] CoAP msg: 69 DEVICE-IP bytearray(b'PE\x00\n\xed\x0b\xf7\x08SHDM-2#DEVICE-MAC#1\xff{"blk":[{"I":0,"D":"Dimmer"}],"sen":[{"I":111,"T":"S","D":"Brightness","R":"0/100","L":0},{"I":121,"T":"S","D":"State","R":"0/1","L":0},{"I":131,"T":"S","D":"Input","R":"0(off)/1(on)/2(longpush)","L":0},{"I":141,"T":"S","D":"Input","R":"0(off)/1(on)/2(longpush)","L":0},{"I":211,"T":"S","D":"Energy counter 0 [W-min]","L":0},{"I":212,"T":"S","D":"Energy counter 1 [W-min]","L":0},{"I":213,"T":"S","D":"Energy counter 2 [W-min]","L":0},{"I":214,"T":"S","D":"Energy counter total [W-min]","L":0},{"I":311,"T":"T","D":"Temperature C","R":"-40/300","L":0},{"I":312,"T":"T","D":"Temperature F","R":"-40/300","L":0},{"I":313,"T":"S","D":"Overtemp","R":"0/1","L":0}]}') 2020-06-20 21:53:42 DEBUG (CoAP) [pyShelly] CoAP Code: 69, Type SHDM-2, Id DEVICE-MAC, Payload {"blk":[{"I":0,"D":"Dimmer"}],"sen":[{"I":111,"T":"S","D":"Brightness","R":"0/100","L":0},{"I":121,"T":"S","D":"State","R":"0/1","L":0},{"I":131,"T":"S","D":"Input","R":"0(off)/1(on)/2(longpush)","L":0},{"I":141,"T":"S","D":"Input","R":"0(off)/1(on)/2(longpush)","L":0},{"I":211,"T":"S","D":"Energycounter0[W-min]","L":0},{"I":212,"T":"S","D":"Energycounter1[W-min]","L":0},{"I":213,"T":"S","D":"Energycounter2[W-min]","L":0},{"I":214,"T":"S","D":"Energycountertotal[W-min]","L":0},{"I":311,"T":"T","D":"TemperatureC","R":"-40/300","L":0},{"I":312,"T":"T","D":"TemperatureF","R":"-40/300","L":0},{"I":313,"T":"S","D":"Overtemp","R":"0/1","L":0}]}
I don't own the device yet, so cannot test directly. But if you have a bit of skill on HASS installation I may tell you what to change.
Simone
I should be able to figure it out with little instruction, please do let me know what you'd like me to try
Any way to chat with you ? Are you on discord ?
Simone
Discord: Giblet#9301 Will probably be available somewhere between 17:00 and 20:00 (GMT+2) Otherwise tomorrow the whole evening
Hi
Same here. Recieved today but doesn't work at the moment. If I can help. Let me know.
Any news? Something to test or try that could help? I've to replace one of my dimmer with dimmer2 and now lost control over HA. :(
Do you think it's reasonable to ask for a followup after a mere 20 hours? Especially on an open source project, which you are not paying for? Just wait paitiently untill there is a solution. Or you could try and edit the source code yourself and make a pull request
I was just asking if there are already some findings... as I don't think it is useful if multiple tring the same thing... but anyway.
If I understand it right the pyShelly is used to discovery the device and the Dimmer2 are not recognized correctly ... so from this perspective I captured CoAP for Dimmer and Dimmer2.
Dimmer:
2020-06-23 14:41:23 DEBUG (CoAP) [pyShelly] CoAP Code: 69, Type SHDM-1, Id F2C2B1, Payload *{"blk":[{"I":0,"D":"Dimmer"}],"sen":[{"I":111,"T":"S","D":"Brightness","R":"0/100","L":0},{"I":121,"T":"S","D":"State","R":"0/1","L":0},{"I":131,"T":"S","D":"Input","R":"0(off)/1(on)/2(longpush)","L":0},{"I":141,"T":"S","D":"Input","R":"0(off)/1(on)/2(longpush)","L":0},{"I":211,"T":"S","D":"Energycounter0[W-min]","L":0},{"I":212,"T":"S","D":"Energycounter1[W-min]","L":0},{"I":213,"T":"S","D":"Energycounter2[W-min]","L":0},{"I":214,"T":"S","D":"Energycountertotal[W-min]","L":0},{"I":311,"T":"T","D":"TemperatureC","R":"-40/300","L":0},{"I":312,"T":"T","D":"TemperatureF","R":"-40/300","L":0},{"I":313,"T":"S","D":"Overtemp","R":"0/1","L":0}]}*
2020-06-23 14:41:33 DEBUG (CoAP) [pyShelly] CoAP Code: 30, Type SHDM-1, Id F2C2B1, Payload *{"G":[[0,111,5],[0,121,0],[0,131,0],[0,141,0],[0,211,0.081],[0,212,0.001],[0,213,0.003],[0,214,73],[0,311,49.12],[0,312,120.42],[0,313,0]]}*
Dimmer2:
2020-06-23 14:41:25 DEBUG (CoAP) [pyShelly] CoAP Code: 69, Type SHDM-2, Id E0980201DBDF, Payload *{"blk":[{"I":0,"D":"Dimmer"}],"sen":[{"I":111,"T":"S","D":"Brightness","R":"0/100","L":0},{"I":121,"T":"S","D":"State","R":"0/1","L":0},{"I":131,"T":"S","D":"Input","R":"0(off)/1(on)/2(longpush)","L":0},{"I":141,"T":"S","D":"Input","R":"0(off)/1(on)/2(longpush)","L":0},{"I":211,"T":"S","D":"Energycounter0[W-min]","L":0},{"I":212,"T":"S","D":"Energycounter1[W-min]","L":0},{"I":213,"T":"S","D":"Energycounter2[W-min]","L":0},{"I":214,"T":"S","D":"Energycountertotal[W-min]","L":0},{"I":311,"T":"T","D":"TemperatureC","R":"-40/300","L":0},{"I":312,"T":"T","D":"TemperatureF","R":"-40/300","L":0},{"I":313,"T":"S","D":"Overtemp","R":"0/1","L":0}]}PE
2020-06-23 14:41:35 DEBUG (CoAP) [pyShelly] CoAP Code: 30, Type SHDM-2, Id E0980201DBDF, Payload *{"G":[[0,111,39],[0,121,0],[0,131,0],[0,141,0],[0,211,0.000],[0,212,0.000],[0,213,0.000],[0,214,0],[0,311,43.82],[0,312,110.88],[0,313,0]]}*
Should be fixed with PR https://github.com/StyraHem/pyShelly/pull/22
Tested with the help of @Gibletron
Simone
Perfect! Thank you very much! 🥇
Is there an easy way to test the library? I found the "block.py" file on my folder custom_components/shelly
but it looks very different from the other one so I doubt it's enought just to replace it.
Perfect! Thank you very much! 🥇
Is there an easy way to test the library? I found the "block.py" file on my folder
custom_components/shelly
but it looks very different from the other one so I doubt it's enought just to replace it.
The folder you should be looking is: /usr/local/lib/python3.7/site-packages/pyShelly Make sure to get a backup of that block.py before replacing/altering it
There is no such folder /usr/local/lib/python3.7/site-packages/pyShelly
probably because I'm using hassio. (HassOS Supervised). So I guess I don't have access to that folder :(
Edit: Found the file... it is insied docker container homeassistant
with the path you mentioned above. I now changed the line in the file there and it works fine!
There is no such folder
/usr/local/lib/python3.7/site-packages/pyShelly
probably because I'm using hassio. (HassOS Supervised). So I guess I don't have access to that folder :(Edit: Found the file... it is insied docker container
homeassistant
with the path you mentioned above. I now changed the line in the file there and it works fine!
Nice :)
Hi everyone, I currently have Home Assistant Supervised installed on a generic Linux system but similarly to Gibletron I cannot find the pySelly file to edit.
Maybe it is my lack of understanding of docker containers as to why I cannot find the file... i have looked in several containers with no luck
Does anyone have a link to some good tutorials that may help or even able to step me though the process?
Thanks
@Meesen0743 You've to exec in docker container of homeassistant
and look there for the file /usr/local/lib/python3.7/site-packages/pyShelly
.
I used docker stats
to find right container. At my supervised install it is called homeassistant
so I do docker exec -it homeassistant bash
and then edit the file with vi /usr/local/lib/python3.7/site-packages/pyShelly/block.py
Hi,
I'm using Shelly Dimmer 2 with HA and also Shelly 1 switch. Shelly 1 is working perfectly. The dimmer does not show a switch and/or functionality to set the brightness? Am I doing something wrong or is there anthor way the integrate the dimmer in HA properly?
Thanks very much for your help.
Hi,
I'm using Shelly Dimmer 2 with HA and also Shelly 1 switch. Shelly 1 is working perfectly. The dimmer does not show a switch and/or functionality to set the brightness? Am I doing something wrong or is there anthor way the integrate the dimmer in HA properly?
Thanks very much for your help.
Support for shelly dimmer 2 will come by default in the next release of ShellyForHASS For now you can follow the instructions above to add support. What I found to be the easiest way using Hassos / Hassio supervised install is:
/usr/local/lib/python3.7/site-packages/pyShelly/block.py
elif self.type == 'SHDM-1':
to
elif self.type == 'SHDM-1' or self.type == 'SHDM-2':
that's it
Hi, I'm using Shelly Dimmer 2 with HA and also Shelly 1 switch. Shelly 1 is working perfectly. The dimmer does not show a switch and/or functionality to set the brightness? Am I doing something wrong or is there anthor way the integrate the dimmer in HA properly? Thanks very much for your help.
Support for shelly dimmer 2 will come by default in the next release of ShellyForHASS For now you can follow the instructions above to add support. What I found to be the easiest way using Hassos / Hassio supervised install is:
- Install Portainer addon
- Use portainer addon to "execute" in the home assisstant container (get a bash shell in the container)
- Edit file:
/usr/local/lib/python3.7/site-packages/pyShelly/block.py
- Change the line (somewhere around line 238):
elif self.type == 'SHDM-1':
toelif self.type == 'SHDM-1' or self.type == 'SHDM-2':
- Save the file
- Reboot the homeassisstant container
that's it
Works great. Thanks a lot!
Would it be possible to explain how to save the file once edited? I’ve managed to find the file but the only option I can see is “Disconnect”
Thank you!
Would it be possible to explain how to save the file once edited? I’ve managed to find the file but the only option I can see is “Disconnect”
Thank you!
to be honest, this is pretty basic linux usage, if you are uncomfortable changing these things you shouldn't be messing with them.
Then again.. if you use the text editor "vi" to edit the file, after your change, you press the "esc" key to get out of text editting mode
Then you use type :wq
followed by the enter/return key to save and clse the file (w = write, q = quit)
Then you can use the disconnect button and restart the container
Would it be possible to explain how to save the file once edited? I’ve managed to find the file but the only option I can see is “Disconnect” Thank you!
to be honest, this is pretty basic linux usage, if you are uncomfortable changing these things you shouldn't be messing with them.
Then again.. if you use the text editor "vi" to edit the file, after your change, you press the "esc" key to get out of text editting mode Then you use type
:wq
followed by the enter/return key to save and clse the file (w = write, q = quit) Then you can use the disconnect button and restart the container
Thank you for your help.
Yes agreed all very new, a bit keen to get the devices online.
Thanks again
Simple way if someone is using HASSIO like me, just execute:
docker exec -it homeassistant sed -i "s/elif self.type == 'SHDM-1':/elif self.type == 'SHDM-1' or self.type == 'SHDM-2':/g" /usr/local/lib/python3.7/site-packages/pyShelly/block.py
https://github.com/StyraHem/pyShelly/blob/master/pyShelly/block.py#L238 and PR is closed? Wtf?
I will make a new PR. Done: https://github.com/StyraHem/pyShelly/pull/25. @hakana can you please review the PR? It's only a small change, but with big impact :).
it is always implemented and will be in next release! That the reason I closed the PR. I just need to fix some issues before I will release.
Thanks!
Support for this device added on 0.1.9b3.
Please test and confirm is fully working.
Simone
Updated. For me it is working fine.
Updated, works fine for me
Just started using this brilliant integration. But I'm running into an issue when using the Shelly Dimmer 2 in combination with the Circadian Lighting integration. It shows this in the logs:
Logboekdetails (ERROR)
Logger: homeassistant.core
Source: custom_components/shelly/light.py:127
First occurred: 22:29:24 (3 occurrences)
Last logged: 22:30:05
Error executing service: <ServiceCall light.turn_on (c:507c16fec8bb4d709f3da60812945548): entity_id=['light.shelly_shdm_2_e098069507cf'], params=color_temp=500, brightness=88, transition=1.0>
Error executing service: <ServiceCall light.turn_on (c:b497b54786cb432e855715d56f5e302d): entity_id=['light.shelly_shdm_2_e098069507cf'], params=color_temp=500, brightness=88, transition=1.0>
Error executing service: <ServiceCall light.turn_on (c:1a699c4c67ab46d889a741837271acaf): entity_id=['light.shelly_shdm_2_e098069507cf'], params=color_temp=500, brightness=88, transition=1.0>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/core.py", line 1266, in catch_exceptions
await coro_or_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1285, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 208, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 454, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 595, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 485, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 242, in async_handle_light_on_service
await light.async_turn_on(**params)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 621, in async_turn_on
await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/shelly/light.py", line 127, in turn_on
if color_temp > self._color_temp_max:
TypeError: '>' not supported between instances of 'int' and 'NoneType'
Is your feature request related to a problem? Please describe.
The Shelly Dimmer 2 has been released and is being shipped, I received mine today! When the devices is added to HA It is recognized as a SHDM-2 Available sensors: Cloud, Temperature, MQTT, Over temperature, RSSI, Uptime. No switch entity seems to be found, nor a light entity
Describe the solution you'd like
Full support for the SHDM-2
Describe alternatives you've considered
None
Additional context
If any testing is needed please do let me know I am fairly new to Home automation, but should be able to help out