rvdvoorde / domoticz-homewizard

Plugin for Domoticz
http://www.domoticz.com/
GNU General Public License v3.0
12 stars 10 forks source link

Watermeter working now (for me) #36

Closed MichaelvanBaarsen closed 3 years ago

MichaelvanBaarsen commented 4 years ago

Hi,

I've played around with the code to get the (Cyble Sensor V2) water meter working via the Energy link in Domoticz. In my case it never updated the variables and constantly produced the following 'error': (HomeWizard) Failed to communicate to system at ip 192.168.x.x and port 80. Command el/get/0/readings.

I've added the following 4 lines of code from line 570 on (copy and paste from line 539 to 552 to the bottom of the try: statement) and removed lines 539 - 546 plus the update statements in 551-552

            water_po   = self.GetValue(Energylinks["s1"], "po"      , 0)
            water_used = self.GetValue(Energylinks["s1"], "dayTotal", 0) # / 1000 > see below
            Data = str(water_used)+";"+str(water_po)   
            UpdateDevice( self.water_id, 0, Data)

I also changed the order for writing _waterused en _waterpo to the Device. From that moment on, the graphs also produced the right data. Only problem I still have with the graph is that today shows the Daytotal from yesterday and is updated the day after to the proper value.

Once I added these lines and removed the others, the counter started working. Also I found out the Domoticz divides the water value with a factor 1000. So either you should set it in Domoticz to 1 or leave it at 1000 and remove it from the Python script.

Hope someone can clean this up a bit so it works for every HomeWizard user.

HB787 commented 3 years ago

@MichaelvanBaarsen Will try your change. I did not get the water device at all, in the logs its saying that it found the p1 Solar and water but the devices are not created. I hope this plugin is updated soon.