ShellyCloudPlugin
Moderator: leecollings
-
- Posts: 178
- Joined: Tuesday 07 June 2016 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Netherlands
- Contact:
Re: ShellyCloudPlugin
hi,
reading this thread with much interest.
I have 12 blinds (rolluiken) controlled by shelly2.5 in roller mode.
Would be great if this app would support shelly2.5 in rollermode. Is there any chance to devellop this?
greetz,
Xavier
reading this thread with much interest.
I have 12 blinds (rolluiken) controlled by shelly2.5 in roller mode.
Would be great if this app would support shelly2.5 in rollermode. Is there any chance to devellop this?
greetz,
Xavier
-
- Posts: 178
- Joined: Tuesday 07 June 2016 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Netherlands
- Contact:
Re: ShellyCloudPlugin
I installed the plugin and tried to add 1 shelly dimmer.
In the logging I have these errors:
2020-10-01 23:57:37.469 Error: (ShellyCloudPlugin) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/ShellyCloud/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-10-01 23:57:37.469 Error: (Keukenlamp) Module Import failed, exception: 'ModuleNotFoundError'
2020-10-01 23:57:37.469 Error: (Keukenlamp) Module Import failed: ' Name: requests'
2020-10-01 23:57:37.469 Error: (Keukenlamp) Error Line details not available.
I'm running Domoticz on a RPi with Python3.7 installed.
Could you please help?
UPDATE:
Found the answer:
on Rpi go to CLI
Then do:
and then do
In the logging I have these errors:
2020-10-01 23:57:37.469 Error: (ShellyCloudPlugin) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/ShellyCloud/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-10-01 23:57:37.469 Error: (Keukenlamp) Module Import failed, exception: 'ModuleNotFoundError'
2020-10-01 23:57:37.469 Error: (Keukenlamp) Module Import failed: ' Name: requests'
2020-10-01 23:57:37.469 Error: (Keukenlamp) Error Line details not available.
I'm running Domoticz on a RPi with Python3.7 installed.
Could you please help?
UPDATE:
Found the answer:
on Rpi go to CLI
Then do:
Code: Select all
pip install requests
Code: Select all
pip3 install requests
Last edited by Xavier82 on Friday 02 October 2020 16:00, edited 1 time in total.
-
- Posts: 178
- Joined: Tuesday 07 June 2016 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Netherlands
- Contact:
Re: ShellyCloudPlugin
Can't the Shelly Cloud API key be a solution:mariopeters wrote: ↑Tuesday 29 September 2020 18:13 I understand your point, but I am still thinking about the practical details.
How do you envision that Domoticz finds the different Shelly devices when adding 1 hardware?
With a Domoticz plugin you can only use text fields (or a dropdown list) for configuration.
One solution would be a text field with a list of ip addresses (";" separated).
However, the Shelly devices must all have the same username and password.
Do you see this as a workable solution?
https://shelly.cloud/documents/develope ... access.pdf
Shelly can also be discoverd with mDNS Discovery:
https://shelly-api-docs.shelly.cloud/#mdns-discovery
Maybe it is possible with these functions to create 1 hardware device and X devices.
Unfortunatly I'm not a programmer but maybe this information can help?
-
- Posts: 178
- Joined: Tuesday 07 June 2016 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Netherlands
- Contact:
Re: ShellyCloudPlugin
So I tried to add the Shelly1PM.
I came as this far:
But in the logging I receive which I can't fix:
Error: (Licht Voordeur) 'onHeartbeat' failed 'KeyError'.
Error: (Licht Voordeur) ----> Line 216 in '/home/pi/domoticz/plugins/ShellyCloud/plugin.py', function onHeartbeat
Error: (Licht Voordeur) ----> Line 181 in '/home/pi/domoticz/plugins/ShellyCloud/plugin.py', function onHeartbeat
Error: (Licht Voordeur) ----> Line 428 in '/home/pi/domoticz/plugins/ShellyCloud/plugin.py', function updateSHSWPM
Error: (Licht Voordeur) ----> Line 538 in '/home/pi/domoticz/plugins/ShellyCloud/plugin.py', function updateMeter
Any help would be appriciated.
I own Shelly 1PM's, Shelly2.5 (in rollermode) ShellyDimmer.
If settings or status could be of any help I would be pleased to share them.
I came as this far:
Code: Select all
# ShellyCloudPlugin
#
# Author: Mario Peters
#
"""
<plugin key="ShellyCloudPlugin" name="Shelly Cloud Plugin" author="Mario Peters" version="1.0.0" wikilink="https://github.com/mario-peters/ShellyCloudPlugin/wiki" externallink="https://github.com/mario-peters/ShellyCloudPlugin">
<description>
<h2>Shelly Cloud Plugin</h2><br/>
Plugin for controlling Shelly devices.
<h3>Configuration</h3>
<ul style="list-style-type:square">
<li>IP Address is the IP Address of the Shelly device. Default value is 127.0.0.1</li>
<li>Username</li>
<li>Password</li>
<li>Type is the type of Shelly device you want to add. Shelly 1, Shelly PM, Shelly 2.5 (only relay), Shelly Dimmer, Shelly RGBW2 (only color), Shelly Bulb, Shelly Door/Window 2 and Shelly Plug-S are currently supported</li>
</ul>
<br/><br/>
</description>
<params>
<param field="Address" label="IP Address" width="200px" required="true" default="127.0.0.1"/>
<param field="Username" label="Username" width="200px" required="true"/>
<param field="Password" label="Password" width="200px" required="true" password="true"/>
<param field="Mode1" label="Type" width="200px" required="true">
<options>
<option label="Shelly 1" value="SHSW-1"/>
<option label="Shelly PM" value="SHSW-PM"/>
<option label="Shelly 2.5" value="SHSW-25"/>
<option label="Shelly Dimmer" value="SHDM-1"/>
<option label="Shelly RGBW2" value="SHRGBW2"/>
<option label="Shelly Bulb" value="SHBLB-1"/>
<option label="Shelly Door/Window 2" value="SHDW-2"/>
<option label="Shelly Plug" value="SHPLG-S"/>
</options>
</param>
</params>
</plugin>
"""
import Domoticz
import requests
import json
class BasePlugin:
#mode = None
mode = "color"
def __init__(self):
return
def onStart(self):
Domoticz.Log("onStart called")
Domoticz.Heartbeat(30)
if len(Devices) == 0:
if Parameters["Mode1"] == "SHDW-2":
createSHDW2()
else:
headers = {'content-type':'application/json'}
try:
response_shelly = requests.get("http://"+Parameters["Address"]+"/settings",headers=headers, auth=(Parameters["Username"], Parameters["Password"]), timeout=(10,10))
json_items = json.loads(response_shelly.text)
response_shelly.close()
if Parameters["Mode1"] == "SHSW-1":
createSHSW1(json_items)
elif Parameters["Mode1"] == "SHSW-25":
createSHSW25(json_items)
elif Parameters["Mode1"] == "SHSW-PM":
createSHSWPM(json_items)
elif Parameters["Mode1"] == "SHDM-1":
createSHDM1(json_items)
elif Parameters["Mode1"] == "SHRGBW2" or Parameters["Mode1"] == "SHBLB-1":
createSHRGBW2(self,json_items)
elif Parameters["Mode1"] == "SHPLG-S":
createSHPLG(json_items)
else:
Domoticz.Log("Type: "+Parameters["Mode1"])
except requests.exceptions.Timeout as e:
Domoticz.Error(str(e))
def onStop(self):
Domoticz.Log("onStop called")
def onConnect(self, Connection, Status, Description):
Domoticz.Log("onConnect called")
def onMessage(self, Connection, Data):
Domoticz.Log("onMessage called")
def onCommand(self, Unit, Command, Level, Hue):
Domoticz.Log("onCommand called for Unit " + str(Unit) + ": Parameter '" + str(Command) + "', Level: " + str(Level))
if Parameters["Mode1"] != "SHDW-2":
headers = {'content-type':'application/json'}
url = "http://"+Parameters["Address"]
if Parameters["Mode1"] == "SHSW-1" or Parameters["Mode1"] == "SHPLG-S":
url = url + "/relay/" + str(Unit-1)
if Parameters["Mode1"] == "SHSW-PM":
url = url + "/relay/" + str(Unit-1)
if Parameters["Mode1"] == "SHSW-25":
url = url + "/relay/" + str(Unit-2)
if Parameters["Mode1"] == "SHDM-1":
url = url + "/light/" + str(Unit-1)
if Parameters["Mode1"] == "SHRGBW2" or Parameters["Mode1"] == "SHBLB-1":
if self.mode == "color":
url = url +"/color/" + str(Unit-1)
if self.mode == "white":
url = url +"/white/" + str(Unit-1)
if str(Command) == "On":
url = url + "?turn=on"
elif str(Command) == "Off":
url = url + "?turn=off"
elif str(Command) == "Set Level":
if self.mode == "color" and Parameters["Mode1"] != "SHDM-1":
url = url + "?turn=on&gain=" + str(Level)
elif self.mode == "white" or Parameters["Mode1"] == "SHDM-1":
url = url + "?turn=on&brightness=" + str(Level)
elif str(Command) == "Set Color":
Domoticz.Debug(str(Devices[Unit].Color))
Domoticz.Debug(str(Hue))
color_info=json.loads(Hue)
r=color_info["r"]
g=color_info["g"]
b=color_info["b"]
m=color_info["m"]
cw=color_info["cw"]
ww=color_info["ww"]
Domoticz.Debug(str(color_info))
url = url + "?turn=on"
if self.mode == "color":
url = url +"&red="+str(r)+"&green="+str(g)+"&blue="+str(b)+"&white="+str(cw)+"&gain="+str(Level)
if self.mode == "white":
url = url +"&white="+str(cw)+"&brightness="+str(Level)
else:
Domoticz.Log("Unknown command: "+str(Command))
Domoticz.Log("url: "+url)
try:
response = requests.get(url,headers=headers, auth=(Parameters["Username"], Parameters["Password"]), timeout=(10,10))
Domoticz.Debug(response.text)
response.close()
except requests.exceptions.Timeout as e:
Domoticz.Error(str(e))
if str(Command) == "On":
Devices[Unit].Update(nValue=1,sValue="On")
elif str(Command) == "Off":
Devices[Unit].Update(nValue=0,sValue="Off")
elif str(Command) == "Set Level":
Devices[Unit].Update(nValue=1,sValue=str(Level))
elif str(Command) == "Set Color":
if self.mode == "color":
#Devices[Unit].Update(nValue=1,sValue=str(Level), Color=str(Hue))
Devices[Unit].Update(nValue=1,sValue=str(Level), Color=json.dumps(Hue))
else:
Devices[Unit].Update(nValue=1,sValue=str(Level))
else:
Domoticz.Log("Unknown command: "+str(Command))
def onNotification(self, Name, Subject, Text, Status, Priority, Sound, ImageFile):
Domoticz.Log("Notification: " + Name + "," + Subject + "," + Text + "," + Status + "," + str(Priority) + "," + Sound + "," + ImageFile)
def onDisconnect(self, Connection):
Domoticz.Log("onDisconnect called")
def onHeartbeat(self):
Domoticz.Log("onHeartbeat called")
if Parameters["Mode1"] != "SHDW-2":
headers = {'content-type':'application/json'}
try:
request_shelly_status = requests.get("http://"+Parameters["Address"]+"/status",headers=headers, auth=(Parameters["Username"], Parameters["Password"]), timeout=(10,10))
Domoticz.Debug(request_shelly_status.text)
json_request = json.loads(request_shelly_status.text)
if Parameters["Mode1"] == "SHSW-1" or Parameters["Mode1"] == "SHPLG-S":
updateSHSW1(json_request)
if Parameters["Mode1"] == "SHSW-PM":
updateSHSWPM(json_request)
if Parameters["Mode1"] == "SHSW-25":
updateSHSW25(json_request)
if Parameters["Mode1"] == "SHDM-1":
updateSHDM1(json_request)
if Parameters["Mode1"] == "SHRGBW2" or Parameters["Mode1"] == "SHBLB-1":
updateSHRGBW2(self, json_request)
request_shelly_status.close()
except requests.exceptions.Timeout as e:
Domoticz.Error(str(e))
global _plugin
_plugin = BasePlugin()
def onStart():
global _plugin
_plugin.onStart()
def onStop():
global _plugin
_plugin.onStop()
def onConnect(Connection, Status, Description):
global _plugin
_plugin.onConnect(Connection, Status, Description)
def onMessage(Connection, Data):
global _plugin
_plugin.onMessage(Connection, Data)
def onCommand(Unit, Command, Level, Hue):
global _plugin
_plugin.onCommand(Unit, Command, Level, Hue)
def onNotification(Name, Subject, Text, Status, Priority, Sound, ImageFile):
global _plugin
_plugin.onNotification(Name, Subject, Text, Status, Priority, Sound, ImageFile)
def onDisconnect(Connection):
global _plugin
_plugin.onDisconnect(Connection)
def onHeartbeat():
global _plugin
_plugin.onHeartbeat()
# Generic helper functions
def DumpConfigToLog():
for x in Parameters:
if Parameters[x] != "":
Domoticz.Debug( "'" + x + "':'" + str(Parameters[x]) + "'")
Domoticz.Debug("Device count: " + str(len(Devices)))
for x in Devices:
Domoticz.Debug("Device: " + str(x) + " - " + str(Devices[x]))
Domoticz.Debug("Device ID: '" + str(Devices[x].ID) + "'")
Domoticz.Debug("Device Name: '" + Devices[x].Name + "'")
Domoticz.Debug("Device nValue: " + str(Devices[x].nValue))
Domoticz.Debug("Device sValue: '" + Devices[x].sValue + "'")
Domoticz.Debug("Device LastLevel: " + str(Devices[x].LastLevel))
return
def createSHSW1(json_items):
relays = None
for key, value in json_items.items():
if key == "relays":
relays = value
count = 0
for relay in relays:
name = createRelay(relay, count)
for key, value in relay.items():
if key == "power":
createPower(name, value, count)
count = count + 1
def createSHSWPM(json_items):
relays = None
mode = None
meters = None
for key, value in json_items.items():
if key == "relays":
relays = value
if key == "mode":
mode = value
if key == "meters":
meters = value
if mode == "relay":
count = 1
for relay in relays:
name = createRelay(relay, count)
meters = {"power":0,"total":0}
createMeter(name, meters, count)
count = count + 1
def createSHSW25(json_items):
relays = None
rollers = None
mode = None
num_meters = None
for key, value in json_items.items():
if key == "relays":
relays = value
if key == "rollers":
rollers = value
if key == "mode":
mode = value
#if key == "meters":
#meters = value
if key == "num_meters":
num_meters = value
Domoticz.Device("Temperature", Unit=1, Used=1, TypeName="Temperature").Create()
if mode == "relay":
count = 1
for relay in relays:
name = createRelay(relay, count)
#meter = meters[1-count]
meter = {"power":0,"total":0}
createMeter(name, meter, count)
count = count + 1
def createSHPLG(json_items):
relays = None
for key, value in json_items.items():
if key == "relays":
relays = value
count = 0;
for relay in relays:
name = createRelay(relay, count)
meter = {"power":0,"total":0}
createMeter(name, meter, count)
count = count + 1
def createSHDM1(json_items):
lights = []
meters = None
brightness = None
for key, value in json_items.items():
if key == "lights":
lights = value
if key == "meters":
meters = value
if key == "brightness":
brightness = value
count = 0
for light in lights:
name = createLight(light, count)
meter = {"power":0,"total":0}
createMeter(name, meter, count)
count = count + 1
def createSHRGBW2(self,json_items):
lights = []
for key, value in json_items.items():
if key == "lights":
lights = value
if key == "mode":
self.mode = value
ison = False
for light in lights:
if key == "ison":
ison = value
self.mode="color"
if self.mode == "color":
Domoticz.Device(Name="RGBW", Unit=1, Used=1, Type=241, Subtype=1).Create()
Domoticz.Device(Name="RGBW_power", Unit=11, Used=1, Type=248, Subtype=1).Create()
Devices[11].Update(nValue=0, sValue="0")
createTotal("RGBW", 0, 0, 0)
elif self.mode == "white":
Domoticz.Device(Name="White", Unit=1, Used=1, Type=241, Subtype=3).Create()
Domoticz.Device(Name="White_power", Unit=11, Used=1, Type=248, Subtype=1).Create()
Devices[11].Update(nValue=0, sValue="0")
createTotal("White", 0, 0, 0)
else:
Domoticz.Log("Unknown mode: "+str(self.mode))
if ison == True:
Devices[1].Update(nValue=1, sValue="On")
def createSHDW2():
Domoticz.Device(Name="SHDW2", Unit=1, Used=1, Type=244, Subtype=73, Switchtype=11).Create()
def createLight(light, count):
name = ""
ison = False
for key, value in light.items():
if key == "name":
name = value
if key == "ison":
ison = value
if name == "" or name is None:
name = "Light"+str(count)
Domoticz.Device(Name=name, Unit=1+count, Used=1, Type=244, Subtype=73, Switchtype=7).Create()
if ison == True:
Devices[1+count].Update(nValue=1, sValue="On")
return name
def createRelay(relay, count):
name = ""
ison = False
for key, value in relay.items():
if key == "name":
name = value
if key == "ison":
ison = value
if name == "" or name is None:
name = "Relay"+str(count)
Domoticz.Device(Name=name, Unit=1+count, Used=1, Type=244, Subtype=73).Create()
if ison == True:
Devices[1+count].Update(nValue=1, sValue="On")
return name
def createMeter(name, meter, count):
power = 0.0
for key, value in meter.items():
if key == "power":
power = value
createPower(name, power, count)
for key, value in meter.items():
if key == "total":
createTotal(name, power, value, count)
def createPower(name, power, count):
Domoticz.Device(Name=name+"_power", Unit=11+count, Used=1, Type=248, Subtype=1).Create()
Devices[11+count].Update(nValue=0, sValue=str(power))
def createTotal(name, power, value, count):
Domoticz.Device(Name=name+"_kWh", Unit=21+count, Used=1, Type=243, Subtype=29).Create()
total = int(value)
total = total/60
total = int(total)
Devices[21+count].Update(nValue=0,sValue=str(power)+";"+str(total))
def updateSHSW1(json_request):
relays = None
meters = None
for key, value in json_request.items():
if key == "relays":
relays = value
if key == "meters":
meters = value
count = 0
for relay in relays:
updateRelay(relay, count)
updateMeter(meters[count], count)
count = count + 1
def updateSHSWPM(json_request):
relays = None
meters = None
for key, value in json_request.items():
if key == "relays":
relays = value
if key == "meters":
meters = value
count = 0
for relay in relays:
updateRelay(relay, count)
updateMeter(meters[count], count)
meters = {"power":0,"total":0}
count = count + 1
def updateSHSW25(json_request):
relays = None
meters = None
for key, value in json_request.items():
if key == "relays":
relays = value
if key == "meters":
meters = value
if key == "temperature":
Devices[1].Update(nValue=Devices[1].nValue, sValue=str(value))
count = 1
for relay in relays:
updateRelay(relay, count)
updateMeter(meters[count-1], count)
count = count + 1
def updateSHDM1(json_request):
lights = []
meters = None
for key, value in json_request.items():
if key == "lights":
lights = value
if key == "meters":
meters = value
count = 0
#Devices[1].Update(nValue=1, sValue="50")
for light in lights:
updateLight(light, count)
updateMeter(meters[count], count)
count = count + 1
def updateSHRGBW2(self, json_request):
lights = []
meters = []
for key, value in json_request.items():
if key == "lights":
lights = value
if key == "meters":
meters = value
count = 0
for light in lights:
updateLight(light, count)
updateMeter(meters[count], count)
count = count + 1
def updateRGBLight(self,light,count):
updateLight(light, count)
m = 0
r = 0
g = 0
b = 0
ww = 0
cw = 0
for key, value in light.items():
if key == "mode":
if value == "color":
m = 3
if value == "white":
m = 1
if key == "red":
r = value
if key == "green":
g = value
if key == "blue":
b = value
if key == "white":
ww = value
if key == "brightness":
ww = value * 255 / 100
if key == "cw":
cw = value
color = json.dumps({
'm': m, #mode 3: RGB
'r': r,
'g': g,
'b': b,
'ww': ww,
'cw': cw
})
Devices[count].Update(nValue=1,sValue="1", Color=str(color))
def updateLight(light, count):
for key, value in light.items():
if key == "ison":
if value:
if Devices[1+count].nValue != 1:
Devices[1+count].Update(nValue=1, sValue=Devices[1+count].sValue)
else:
Devices[1+count].Update(nValue=0, sValue=Devices[1+count].sValue)
if key == "brightness":
Devices[1+count].Update(nValue=Devices[1+count].nValue, sValue=str(value))
def updateRelay(relay, count):
for key, value in relay.items():
if key == "ison":
if value:
if Devices[1+count].nValue != 1:
Devices[1+count].Update(nValue=1, sValue="On")
else:
Devices[1+count].Update(nValue=0, sValue="Off")
def updateMeter(meters, count):
power = ""
for key, value in meters.items():
if key == "power":
power = str(value)
Devices[11+count].Update(nValue=0,sValue=power)
for key, value in meters.items():
if key == "total":
total=int(value)
total=total/60
total=int(total)
Devices[21+count].Update(nValue=0,sValue=power+";"+str(total))
Error: (Licht Voordeur) 'onHeartbeat' failed 'KeyError'.
Error: (Licht Voordeur) ----> Line 216 in '/home/pi/domoticz/plugins/ShellyCloud/plugin.py', function onHeartbeat
Error: (Licht Voordeur) ----> Line 181 in '/home/pi/domoticz/plugins/ShellyCloud/plugin.py', function onHeartbeat
Error: (Licht Voordeur) ----> Line 428 in '/home/pi/domoticz/plugins/ShellyCloud/plugin.py', function updateSHSWPM
Error: (Licht Voordeur) ----> Line 538 in '/home/pi/domoticz/plugins/ShellyCloud/plugin.py', function updateMeter
Any help would be appriciated.
I own Shelly 1PM's, Shelly2.5 (in rollermode) ShellyDimmer.
If settings or status could be of any help I would be pleased to share them.
-
- Posts: 89
- Joined: Friday 15 September 2017 18:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10076
- Location: Germany
- Contact:
Re: ShellyCloudPlugin
I have the same Errorlog with Shelly 1. With 2.5 no errors
2020-10-04 17:01:23.670 Error: (küche) ----> Line 209 in '/home/pi/domoticz/plugins/ShellyCloudPlugin-master/plugin.py', function onHeartbeat
2020-10-04 17:01:23.670 Error: (küche) ----> Line 174 in '/home/pi/domoticz/plugins/ShellyCloudPlugin-master/plugin.py', function onHeartbeat
2020-10-04 17:01:23.670 Error: (küche) ----> Line 388 in '/home/pi/domoticz/plugins/ShellyCloudPlugin-master/plugin.py', function updateSHSW1
2020-10-04 17:01:23.671 Error: (küche) ----> Line 497 in '/home/pi/domoticz/plugins/ShellyCloudPlugin-master/plugin.py', function updateMeter
2020-10-04 17:01:23.670 Error: (küche) ----> Line 209 in '/home/pi/domoticz/plugins/ShellyCloudPlugin-master/plugin.py', function onHeartbeat
2020-10-04 17:01:23.670 Error: (küche) ----> Line 174 in '/home/pi/domoticz/plugins/ShellyCloudPlugin-master/plugin.py', function onHeartbeat
2020-10-04 17:01:23.670 Error: (küche) ----> Line 388 in '/home/pi/domoticz/plugins/ShellyCloudPlugin-master/plugin.py', function updateSHSW1
2020-10-04 17:01:23.671 Error: (küche) ----> Line 497 in '/home/pi/domoticz/plugins/ShellyCloudPlugin-master/plugin.py', function updateMeter
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
-
- Posts: 61
- Joined: Wednesday 22 August 2018 12:18
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: ShellyCloudPlugin
@DarkG, @Xavier82,
Can you both send the result (from the browser) of "http: //<ip shelly device>/status" to me in a private message.
Then I will investigate the problem.
Can you both send the result (from the browser) of "http: //<ip shelly device>/status" to me in a private message.
Then I will investigate the problem.
-
- Posts: 178
- Joined: Tuesday 07 June 2016 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Netherlands
- Contact:
Re: ShellyCloudPlugin
@mariopeters:
Done
Done
-
- Posts: 178
- Joined: Tuesday 07 June 2016 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Netherlands
- Contact:
Re: ShellyCloudPlugin
@mariopeters:
Btw I think when you resolve the issues of Shelly 1 the errors are also fixed for 1PM about this because I copied some code from Shelly1 to create shelly 1PM.....
Btw I think when you resolve the issues of Shelly 1 the errors are also fixed for 1PM about this because I copied some code from Shelly1 to create shelly 1PM.....
-
- Posts: 178
- Joined: Tuesday 07 June 2016 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Netherlands
- Contact:
Re: ShellyCloudPlugin
Thanks @mariopeters !
Shelly1PM works now
ShellyDimmer (version 1) works also great
Shelly1PM works now
ShellyDimmer (version 1) works also great
-
- Posts: 61
- Joined: Wednesday 22 August 2018 12:18
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: ShellyCloudPlugin
Thanks Xavier82.
@DarkG, Xavier82 also confirmed that with the new code the error is gone.
Perhaps you should delete your device, update the code and try again?
By the way I haven't found any error.
If you still have this error, then perhaps you could answer my private message.
@DarkG, Xavier82 also confirmed that with the new code the error is gone.
Perhaps you should delete your device, update the code and try again?
By the way I haven't found any error.
If you still have this error, then perhaps you could answer my private message.
-
- Posts: 89
- Joined: Friday 15 September 2017 18:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10076
- Location: Germany
- Contact:
Re: ShellyCloudPlugin
The Shelly 1 has no power Output like 2.5 or 1 PM
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
-
- Posts: 178
- Joined: Tuesday 07 June 2016 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Netherlands
- Contact:
Re: ShellyCloudPlugin
I also found this:
https://github.com/StyraHem/pyShelly
and
https://pypi.org/project/pyShelly/#modal-close
perhaps this can be of any help?
https://github.com/StyraHem/pyShelly
and
https://pypi.org/project/pyShelly/#modal-close
perhaps this can be of any help?
-
- Posts: 133
- Joined: Tuesday 04 February 2014 21:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Isère, France
- Contact:
Re: ShellyCloudPlugin
Hi I have an issue today...
My energy graph is showing 0Wh while my sensor is correctly accumulated the energy, strange
My energy graph is showing 0Wh while my sensor is correctly accumulated the energy, strange
-
- Posts: 133
- Joined: Tuesday 04 February 2014 21:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Isère, France
- Contact:
Re: ShellyCloudPlugin
Other issue that I have.
The sensor indicate
1.890kWh But in LUA I get 7688kWh, strange!
LUA: 274.05;7688
The sensor indicate
1.890kWh But in LUA I get 7688kWh, strange!
LUA: 274.05;7688
-
- Posts: 178
- Joined: Tuesday 07 June 2016 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Netherlands
- Contact:
Re: ShellyCloudPlugin
Could you please add temperature (internal) for the Shelly1PM.
Shelly1 doesn't have internal temperature.
Shelly1 doesn't have internal temperature.
-
- Posts: 178
- Joined: Tuesday 07 June 2016 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Netherlands
- Contact:
Re: ShellyCloudPlugin
I have now added the temp device for Shelly1PM. I added
Code: Select all
Domoticz.Device("Temperature", Unit=31, Used=1, TypeName="Temperature").Create()
Code: Select all
def createSHSWPM(json_items):
Domoticz.Device("Temperature", Unit=31, Used=1, TypeName="Temperature").Create()
relays = None
for key, value in json_items.items():
if key == "relays":
relays = value
count = 0
for relay in relays:
name = createRelay(relay, count)
meter={"power":0,"total":0}
createMeter(name, meter, count)
count = count + 1
I have now:
Code: Select all
def updateSHSWPM(json_request):
relays = None
meters = None
for key, value in json_request.items():
if key == "relays":
relays = value
if key == "meters":
meters = value
if key == "temperature":
Devices[1].Update(nValue=Devices[1].nValue, sValue=str(value))
count = 0
for relay in relays:
updateRelay(relay, count)
updateMeter(meters[count], count)
count = count + 1
Re: ShellyCloudPlugin
I have got the same issue. Also have Python 3.x installed, but these commands does not seems to work. Anyone got an idea?Xavier82 wrote: ↑Friday 02 October 2020 0:02 I installed the plugin and tried to add 1 shelly dimmer.
In the logging I have these errors:
2020-10-01 23:57:37.469 Error: (ShellyCloudPlugin) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/ShellyCloud/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-10-01 23:57:37.469 Error: (Keukenlamp) Module Import failed, exception: 'ModuleNotFoundError'
2020-10-01 23:57:37.469 Error: (Keukenlamp) Module Import failed: ' Name: requests'
2020-10-01 23:57:37.469 Error: (Keukenlamp) Error Line details not available.
I'm running Domoticz on a RPi with Python3.7 installed.
Could you please help?
UPDATE:
Found the answer:
on Rpi go to CLI
Then do:and then doCode: Select all
pip install requests
Code: Select all
pip3 install requests
Code: Select all
2020-10-15 20:41:12.785 Error: (ShellyCloudPlugin) failed to load 'plugin.py', Python Path used was '/usr/local/domoticz/var/plugins/ShellyCloudPlugin-master/:/usr/local/domoticz/lib/python37.zip:/usr/local/domoticz/lib/python3.7:/usr/local/domoticz/lib/python3.7/lib-dynload:/usr/local/domoticz/lib/python3.7/site-packages'.
2020-10-15 20:41:12.785 Error: (Shelly Cloud Plugin) Module Import failed, exception: 'ModuleNotFoundError'
2020-10-15 20:41:12.785 Error: (Shelly Cloud Plugin) Module Import failed: ' Name: requests'
-
- Posts: 178
- Joined: Tuesday 07 June 2016 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Netherlands
- Contact:
Re: ShellyCloudPlugin
did you tried the commands with sudo?CronoS wrote: ↑Thursday 15 October 2020 21:00I have got the same issue. Also have Python 3.x installed, but these commands does not seems to work. Anyone got an idea?Xavier82 wrote: ↑Friday 02 October 2020 0:02 I installed the plugin and tried to add 1 shelly dimmer.
In the logging I have these errors:
2020-10-01 23:57:37.469 Error: (ShellyCloudPlugin) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/ShellyCloud/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-10-01 23:57:37.469 Error: (Keukenlamp) Module Import failed, exception: 'ModuleNotFoundError'
2020-10-01 23:57:37.469 Error: (Keukenlamp) Module Import failed: ' Name: requests'
2020-10-01 23:57:37.469 Error: (Keukenlamp) Error Line details not available.
I'm running Domoticz on a RPi with Python3.7 installed.
Could you please help?
UPDATE:
Found the answer:
on Rpi go to CLI
Then do:and then doCode: Select all
pip install requests
Code: Select all
pip3 install requests
Code: Select all
2020-10-15 20:41:12.785 Error: (ShellyCloudPlugin) failed to load 'plugin.py', Python Path used was '/usr/local/domoticz/var/plugins/ShellyCloudPlugin-master/:/usr/local/domoticz/lib/python37.zip:/usr/local/domoticz/lib/python3.7:/usr/local/domoticz/lib/python3.7/lib-dynload:/usr/local/domoticz/lib/python3.7/site-packages'. 2020-10-15 20:41:12.785 Error: (Shelly Cloud Plugin) Module Import failed, exception: 'ModuleNotFoundError' 2020-10-15 20:41:12.785 Error: (Shelly Cloud Plugin) Module Import failed: ' Name: requests'
-
- Posts: 89
- Joined: Friday 15 September 2017 18:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10076
- Location: Germany
- Contact:
Re: ShellyCloudPlugin
Yes it must execute with sudo. Did have the same problem.
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
Re: ShellyCloudPlugin
I am one step further. I was able to executy the pip3 command with ./pip3 in front
The installation seems to work; but it uses Python 3.5 I think
The plugin then still failed. It seems it needs that this stuff needs to be installed on Python 3.7. I was able to install PIP for Python 3.7, but now it still doesn't work because it seems to search in the Domoticz folder. Any idea how I can modify it, or install PIP here?
Shelly Cloud Plugin) Started.
2020-10-16 14:35:56.219 Error: (ShellyCloudPlugin) failed to load 'plugin.py', Python Path used was '/usr/local/domoticz/var/plugins/ShellyCloudPlugin-master/:/usr/local/domoticz/lib/python37.zip:/usr/local/domoticz/lib/python3.7:/usr/local/domoticz/lib/python3.7/lib-dynload:/usr/local/domoticz/lib/python3.7/site-packages'.
2020-10-16 14:35:56.219 Error: (Shelly Cloud Plugin) Module Import failed, exception: 'ModuleNotFoundError'
2020-10-16 14:35:56.219 Error: (Shelly Cloud Plugin) Module Import failed: ' Name: requests'
2020-10-16 14:35:56.219 Error: (Shelly Cloud Plugin) Error Line details not available.
Who is online
Users browsing this forum: Bing [Bot] and 1 guest