ShellyCloudPlugin

Python and python framework

Moderator: leecollings

CronoS
Posts: 135
Joined: Wednesday 15 July 2015 23:40
Target OS: -
Domoticz version:
Contact:

Re: ShellyCloudPlugin

Post by CronoS »

Xavier82 wrote: Wednesday 28 October 2020 19:18 which python version do you have?
Are u using a Raspberry Pi or something else?

For Rpi go to cli (with Putty).
then enter "python -V" (without the ")
this will show which python 2 version you have.
next enter "python3 -V".
this will show which python3 version you have.

then enter "sudo su -" and give password.
You should now be able to enter the next command:
"pip install requests" (this is the command for python version2)

or

"pip3 install requests"
(this is the command for python3)

if everything is ok the requests library should be installed and the script should work.
The problem is that it is on a Synology. The pip package does install correctly, I also see it. Butthe domoticz installation doesn't find that pip installation folder because it looks at a python folder in it's own installation folder. I don't know why Domoticz is doing that on a Synology.
mariopeters
Posts: 61
Joined: Wednesday 22 August 2018 12:18
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: ShellyCloudPlugin

Post by mariopeters »

I think I know the problem.
In the past I also installed Domoticz on a Synology NAS.
Did you also install python3 from Synology.
If so you are using the python version located in

Code: Select all

/volume1/@appstore/py3k
(depending on how many volumes you have).
In this directory you will another directory

Code: Select all

/usr/local/lib/python3.5
where you need to place the requests lib.
CronoS
Posts: 135
Joined: Wednesday 15 July 2015 23:40
Target OS: -
Domoticz version:
Contact:

Re: ShellyCloudPlugin

Post by CronoS »

mariopeters wrote: Saturday 31 October 2020 10:42 I think I know the problem.
In the past I also installed Domoticz on a Synology NAS.
Did you also install python3 from Synology.
If so you are using the python version located in

Code: Select all

/volume1/@appstore/py3k
(depending on how many volumes you have).
In this directory you will another directory

Code: Select all

/usr/local/lib/python3.5
where you need to place the requests lib.
Unfortunately still the same error. If I look in the folder "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages" the requests folder is there. But my domoticz installation is looking in: /usr/local/domoticz/lib/python3.7/site-packages, which is basically a subfolder in the Domoticz folder. Don't know why it is like that..
DarkG
Posts: 89
Joined: Friday 15 September 2017 18:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10076
Location: Germany
Contact:

Re: ShellyCloudPlugin

Post by DarkG »

why do you not copy the folder?
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
DarkG
Posts: 89
Joined: Friday 15 September 2017 18:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10076
Location: Germany
Contact:

Re: ShellyCloudPlugin

Post by DarkG »

Can someone please edit the script für Shelly 1.

My log is full with this for all my shelly 1 devices. and that are many devices

2020-11-12 00:58:32.265 Error: (badezimmer) 'onHeartbeat' failed 'KeyError'.
2020-11-12 00:58:32.265 Error: (badezimmer) ----> Line 209 in '/home/pi/domoticz/plugins/ShellyCloudPlugin-master/plugin.py', function onHeartbeat
2020-11-12 00:58:32.265 Error: (badezimmer) ----> Line 174 in '/home/pi/domoticz/plugins/ShellyCloudPlugin-master/plugin.py', function onHeartbeat
2020-11-12 00:58:32.265 Error: (badezimmer) ----> Line 388 in '/home/pi/domoticz/plugins/ShellyCloudPlugin-master/plugin.py', function updateSHSW1
2020-11-12 00:58:32.265 Error: (badezimmer) ----> Line 497 in '/home/pi/domoticz/plugins/ShellyCloudPlugin-master/plugin.py', function updateMeter



with the 2.5 modules there is no problem
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
darrepac
Posts: 133
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: ShellyCloudPlugin

Post by darrepac »

On my side, it is working ok but the log has a lot of error like this:
HTTPConnectionPool(host='192.168.0.54', port=80): Max retries exceeded with url: /status (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x6071b190>, 'Connection to 192.168.0.54 timed out. (connect timeout=10)'))
mariopeters
Posts: 61
Joined: Wednesday 22 August 2018 12:18
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: ShellyCloudPlugin

Post by mariopeters »

darrepac wrote: Wednesday 18 November 2020 7:50 On my side, it is working ok but the log has a lot of error like this:
HTTPConnectionPool(host='192.168.0.54', port=80): Max retries exceeded with url: /status (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x6071b190>, 'Connection to 192.168.0.54 timed out. (connect timeout=10)'))
Domoticz doen't like long http requests.
So for the most of the requests I added a timeout of 10 seconds.
In your example the status update (health check) took longer than 10 seconds.
In my opinion this is very long for a simple request on a local network.
Perhaps you could try to reproduce it from a command line or browser to check whether or not you have latency on your network.
alecc
Posts: 4
Joined: Friday 20 December 2019 18:14
Target OS: -
Domoticz version:
Contact:

Re: ShellyCloudPlugin

Post by alecc »

Hi,
I've installed shellies and this plugin for domoticz. All works fine until one of the shelly (shelly 1) disconnect from the wifi and never reconnect to it.
Consequently, a lot of errors logged by the plugin in domoticz due to the disconnection.
I've tried to disable the device (don't want to delete it) in domoticz but no action in the logs;
Is it possible to change the plugin in order to log only if the device is enable in order to stop the disconnection error logs (every 30s).

Thanks

EDIT : I've tried do delete the shelly devices (3 per shelly 1) created by the plugin, but the errors logs doesnt stop =》 how can we properly delete a device ? Do i have to restart domoticz ?
EDIT2 : I've tried to restart domoticz => nothing new, i've tried to delete "__pycache__" under plugin directory and restart domoticz but nothing new, onHeartbeat is called every 30s but with the 3 shellies instead of 2 (1 deleted)
alecc
Posts: 4
Joined: Friday 20 December 2019 18:14
Target OS: -
Domoticz version:
Contact:

Re: ShellyCloudPlugin

Post by alecc »

Hi,
i answer myself : the only way i've found is to delete the line of the hardware directly in the hardware table of the domoticz DB
Works fine
I think it should be possible to delete the hardware added directly in the hardware GUI page
zuputrus
Posts: 9
Joined: Saturday 23 January 2021 16:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Madrid. Spain
Contact:

Re: ShellyCloudPlugin

Post by zuputrus »

Since it's possible to have 2 router at home, one master and other repeating signal, but instead of 192.168.1.xxx it could be 192.168.31.xxx.
How could be possible to detect one shelly device connected to second wifi? It doesn't work for me, at least.
I have some shellys devices in first wifi 192.168.1.xx and plugin works perfectly, but when i try to add other shelly in second wifi domoticz says that has created devices but really it doesn't.
samourai47
Posts: 50
Joined: Wednesday 06 March 2019 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ShellyCloudPlugin

Post by samourai47 »

Hello
I installed my first shelly device with cloud. I found this plugin and i want to try
I installed and i have some errors

Code: Select all

 2021-01-28 07:51:35.291 Error: (Shelly) 'onHeartbeat' failed 'ConnectionError'.
2021-01-28 07:51:35.291 Error: (Shelly) ----> Line 230 in '/home/pi/domoticz/plugins/Shelly/plugin.py', function onHeartbeat
2021-01-28 07:51:35.291 Error: (Shelly) ----> Line 195 in '/home/pi/domoticz/plugins/Shelly/plugin.py', function onHeartbeat
2021-01-28 07:51:35.291 Error: (Shelly) ----> Line 75 in '/usr/lib/python3/dist-packages/requests/api.py', function get
2021-01-28 07:51:35.291 Error: (Shelly) ----> Line 60 in '/usr/lib/python3/dist-packages/requests/api.py', function request
2021-01-28 07:51:35.291 Error: (Shelly) ----> Line 533 in '/usr/lib/python3/dist-packages/requests/sessions.py', function request
2021-01-28 07:51:35.291 Error: (Shelly) ----> Line 646 in '/usr/lib/python3/dist-packages/requests/sessions.py', function send
2021-01-28 07:51:35.291 Error: (Shelly) ----> Line 498 in '/usr/lib/python3/dist-packages/requests/adapters.py', function send
2021-01-28 08:36:20.467 Error: Error parsing http request.
2021-01-28 08:36:21.022 Error: Error parsing http request.
2021-01-28 08:36:21.565 Error: Error parsing http request.
2021-01-28 08:36:22.109 Error: Error parsing http request.
2021-01-28 08:38:18.680 Error: (Shelly) HTTPConnectionPool(host='192.168.0.91', port=80): Max retries exceeded with url: /status (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x623eef70>, 'Connection to 192.168.0.91 timed out. (connect timeout=10)'))
2021-01-28 08:54:00.182 Error: (Shelly) HTTPConnectionPool(host='192.168.0.91', port=80): Max retries exceeded with url: /status (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x623ef190>, 'Connection to 192.168.0.91 timed out. (connect timeout=10)'))
2021-01-28 08:54:39.727 Error: (Shelly) HTTPConnectionPool(host='192.168.0.91', port=80): Max retries exceeded with url: /status (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x623ef590>, 'Connection to 192.168.0.91 timed out. (connect timeout=10)'))
2021-01-28 08:55:12.405 Error: (Shelly) 'onHeartbeat' failed 'ConnectionError'.
2021-01-28 08:55:12.406 Error: (Shelly) ----> Line 230 in '/home/pi/domoticz/plugins/Shelly/plugin.py', function onHeartbeat
2021-01-28 08:55:12.406 Error: (Shelly) ----> Line 195 in '/home/pi/domoticz/plugins/Shelly/plugin.py', function onHeartbeat
2021-01-28 08:55:12.406 Error: (Shelly) ----> Line 75 in '/usr/lib/python3/dist-packages/requests/api.py', function get
2021-01-28 08:55:12.406 Error: (Shelly) ----> Line 60 in '/usr/lib/python3/dist-packages/requests/api.py', function request
2021-01-28 08:55:12.406 Error: (Shelly) ----> Line 533 in '/usr/lib/python3/dist-packages/requests/sessions.py', function request
2021-01-28 08:55:12.406 Error: (Shelly) ----> Line 646 in '/usr/lib/python3/dist-packages/requests/sessions.py', function send
2021-01-28 08:55:12.406 Error: (Shelly) ----> Line 516 in '/usr/lib/python3/dist-packages/requests/adapters.py', function send
2021-01-28 08:55:51.980 Error: (Shelly) HTTPConnectionPool(host='192.168.0.91', port=80): Max retries exceeded with url: /status (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x623efd90>, 'Connection to 192.168.0.91 timed out. (connect timeout=10)'))
2021-01-28 08:56:31.558 Error: (Shelly) HTTPConnectionPool(host='192.168.0.91', port=80): Max retries exceeded with url: /status (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x6238c1b0>, 'Connection to 192.168.0.91 timed out. (connect timeout=10)'))
2021-01-28 08:57:04.246 Error: (Shelly) 'onHeartbeat' failed 'ConnectionError'.
2021-01-28 08:57:04.246 Error: (Shelly) ----> Line 230 in '/home/pi/domoticz/plugins/Shelly/plugin.py', function onHeartbeat 
With a dummy capteur i wroks with this instruction

Code: Select all

http://192.168.0.91/relay/0?turn=on
Have an idea aund can you give me some help

Thank's
extremeaudio
Posts: 47
Joined: Tuesday 24 November 2020 17:57
Target OS: Linux
Domoticz version:
Contact:

Re: ShellyCloudPlugin

Post by extremeaudio »

Hi, I installed the plugin but cannot see it in the hardware list.

Log gives error .

Code: Select all

Error: PluginList: Parsing '/home/pi/domoticz/plugins/ShellyCloudPlugin/', 'Error document empty.' at line 0 column 0 in XML ''.
What could be the issue?
DarkG
Posts: 89
Joined: Friday 15 September 2017 18:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10076
Location: Germany
Contact:

Re: ShellyCloudPlugin

Post by DarkG »

empty xml in folder
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
extremeaudio
Posts: 47
Joined: Tuesday 24 November 2020 17:57
Target OS: Linux
Domoticz version:
Contact:

Re: ShellyCloudPlugin

Post by extremeaudio »

Empty XML in which folder? The Shelly plugin folder only has a plugin.py file and a readme file. There is no XML.

Here is how I installed ..

From WinSCP

Created a folder called ShellyCloud under Domoticz-Plug-ins
Copied the plugin.py and readme.md files into the folder
Changed permissions to 0777 or whatever has the max rights by right clicking on the files and from properties

Restart Domoticz


Ignore everything. Got it working. Was not following the correct procedure for installing the plugin. Sorry.
extremeaudio
Posts: 47
Joined: Tuesday 24 November 2020 17:57
Target OS: Linux
Domoticz version:
Contact:

Re: ShellyCloudPlugin

Post by extremeaudio »

All my other shelly devices are working, but my RGBW (which I am using in 4 white LED strips mode) is not working

Code: Select all

2021-04-08 16:57:55.304 Error: (Cove) 'onHeartbeat' failed 'KeyError'.
2021-04-08 16:57:55.304 Error: (Cove) ----> Line 230 in '/home/pi/domoticz/plugins/ShellyCloudPlugin/plugin.py', function onHeartbeat
2021-04-08 16:57:55.304 Error: (Cove) ----> Line 195 in '/home/pi/domoticz/plugins/ShellyCloudPlugin/plugin.py', function onHeartbeat
2021-04-08 16:57:55.304 Error: (Cove) ----> Line 466 in '/home/pi/domoticz/plugins/ShellyCloudPlugin/plugin.py', function updateSHRGBW2
2021-04-08 16:57:55.304 Error: (Cove) ----> Line 513 in '/home/pi/domoticz/plugins/ShellyCloudPlugin/plugin.py', function updateLight
These are the errors in the logs.
extremeaudio
Posts: 47
Joined: Tuesday 24 November 2020 17:57
Target OS: Linux
Domoticz version:
Contact:

Re: ShellyCloudPlugin

Post by extremeaudio »

Any help with the previous post please ?

I have set my RGBW2 to 4 white channels

But when I make changes in the switch in domoticz I can see commands in the log..

Code: Select all

2021-04-15 21:58:19.008 (Cove) url: http://192.168.1.65/color/0
instead of 'color' int he above url it needs to be white. Will the plugin automatically detect that the shelly is set to 4 white channels? Because I dont see any setting in the add hardware section of domoticz.

Please help with this.
DarkG
Posts: 89
Joined: Friday 15 September 2017 18:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10076
Location: Germany
Contact:

Re: ShellyCloudPlugin

Post by DarkG »

Today my 3EM arrived. Can you add this to your plugin?

Code: Select all

{"device":{"type":"SHEM-3","mac":"8CAAB561D496","hostname":"shellyem3-8CAAB561D496","num_outputs":1,"num_meters":0,"num_emeters":3,"report_period":1},"wifi_ap":{"enabled":false,"ssid":"shellyem3-8CAAB561D496","key":""},"wifi_sta":{"enabled":true,"ssid":"","ipv4_method":"dhcp","ip":null,"gw":null,"mask":null,"dns":null},"wifi_sta1":{"enabled":false,"ssid":null,"ipv4_method":"dhcp","ip":null,"gw":null,"mask":null,"dns":null},"ap_roaming":{"enabled":false,"threshold":-70},"mqtt": {"enable":false,"server":"192.168.33.3:1883","user":"","id":"shellyem3-8CAAB561D496","reconnect_timeout_max":60.000000,"reconnect_timeout_min":2.000000,"clean_session":true,"keep_alive":60,"max_qos":0,"retain":false,"update_period":30},"coiot": {"enabled":true,"update_period":15,"peer":""},"sntp":{"server":"time.google.com","enabled":true},"login":{"enabled":false,"unprotected":false,"username":"admin"},"pin_code":"OPSoqf","name":"Zuleitung HAK","fw":"20210413-154243/v1.10.2-gb89901a","discoverable":false,"build_info":{"build_id":"20210413-154243/v1.10.2-gb89901a","build_timestamp":"2021-04-13T15:42:43Z","build_version":"1.0"},"cloud":{"enabled":true,"connected":true},"timezone":"Europe/Berlin","lat":50.937931,"lng":6.878530,"tzautodetect":true,"tz_utc_offset":7200,"tz_dst":true,"tz_dst_auto":true,"time":"14:00","unixtime":1618660820,"led_status_disable":false,"debug_enable":false,"allow_cross_origin":false,"actions":{"active":false,"names":["out_on_url","out_off_url","over_power_url","under_power_url","over_power_url","under_power_url","over_power_url","under_power_url","over_power_url","under_power_url"]},"hwinfo":{"hw_revision":"prod-2020-1", "batch_id":1},"relays":[{"name":null,"ison":false,"has_timer":false,"default_state":"off","auto_on":0.00,"auto_off":0.00,"schedule":false,"schedule_rules":[]}],"emeters":[{"name":null,"appliance_type":"General","max_power":0},{"name":null,"appliance_type":"General","max_power":0},{"name":null,"appliance_type":"General","max_power":0}],"wifirecovery_reboot_enabled":true}

Code: Select all

{"wifi_sta":{"connected":true,"ssid":"","ip":"192.168.0.60","rssi":-42},"cloud":{"enabled":true,"connected":true},"mqtt":{"connected":false},"time":"14:01","unixtime":1618660881,"serial":342,"has_update":false,"mac":"8CAAB561D496","cfg_changed_cnt":5,"actions_stats":{"skipped":0},"relays":[{"ison":false,"has_timer":false,"timer_started":0,"timer_duration":0,"timer_remaining":0,"overpower":false,"is_valid":true,"source":"input"}],"emeters":[{"power":134.73,"pf":0.59,"current":0.99,"voltage":231.84,"is_valid":true,"total":68.2,"total_returned":16.2},{"power":131.37,"pf":0.51,"current":1.11,"voltage":231.84,"is_valid":true,"total":89.8,"total_returned":22.5},{"power":22.94,"pf":0.61,"current":0.16,"voltage":231.18,"is_valid":true,"total":6.9,"total_returned":0.3}],"fs_mounted":true,"update":{"status":"idle","has_update":false,"new_version":"20210413-154243/v1.10.2-gb89901a","old_version":"20210413-154243/v1.10.2-gb89901a"},"ram_total":48784,"ram_free":29728,"fs_size":233681,"fs_free":156122,"uptime":1890}
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: ShellyCloudPlugin

Post by EdwinK »

Have this error's:

Code: Select all

2021-08-12 17:24:24.121 Error: Shelly: (Shelly) 'onHeartbeat' failed 'JSONDecodeError':'Expecting value: line 1 column 1 (char 0)'.
2021-08-12 17:24:24.121 Error: Shelly: (Shelly) ----> Line 230 in '/home/pi/domoticz/plugins/shelly_Cloud/plugin.py', function onHeartbeat
2021-08-12 17:24:24.121 Error: Shelly: (Shelly) ----> Line 195 in '/home/pi/domoticz/plugins/shelly_Cloud/plugin.py', function onHeartbeat
2021-08-12 17:24:24.121 Error: Shelly: (Shelly) ----> Line 348 in '/usr/lib/python3.7/json/__init__.py', function loads
2021-08-12 17:24:24.121 Error: Shelly: (Shelly) ----> Line 337 in '/usr/lib/python3.7/json/decoder.py', function decode
2021-08-12 17:24:24.121 Error: Shelly: (Shelly) ----> Line 355 in '/usr/lib/python3.7/json/decoder.py', function raw_decode
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
extremeaudio
Posts: 47
Joined: Tuesday 24 November 2020 17:57
Target OS: Linux
Domoticz version:
Contact:

Re: ShellyCloudPlugin

Post by extremeaudio »

Is it possible to include support for Shelly RGBW in 4 white mode. Right now only working as RGBW mode
tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ShellyCloudPlugin

Post by tjabas »

hi!

i have installed this plugin but i get these errors:
2021-12-14 20:54:06.112 Error: Zappi: (Zappi) 'onHeartbeat' failed 'JSONDecodeError'.
2021-12-14 20:54:06.112 Error: Zappi: (Zappi) ----> Line 230 in '/home/pi/domoticz/plugins/ShellyCloudPlugin-master/plugin.py', function onHeartbeat
2021-12-14 20:54:06.112 Error: Zappi: (Zappi) ----> Line 195 in '/home/pi/domoticz/plugins/ShellyCloudPlugin-master/plugin.py', function onHeartbeat
2021-12-14 20:54:06.112 Error: Zappi: (Zappi) ----> Line 348 in '/usr/lib/python3.7/json/__init__.py', function loads
2021-12-14 20:54:06.112 Error: Zappi: (Zappi) ----> Line 337 in '/usr/lib/python3.7/json/decoder.py', function decode
2021-12-14 20:54:06.112 Error: Zappi: (Zappi) ----> Line 355 in '/usr/lib/python3.7/json/decoder.py', function raw_decode


i have searched this thread but i cant figure it out what to do to fix this.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests