YouLess LS110 Energy Monitor

Forum about Domotica, home automation and saving energy.
Rutger
Member
Member
Posts: 339
Joined: Wed May 19, 2010 8:48 pm
Location: Netherlands

Re: YouLess LS110 Energy Monitor

Post by Rutger »

Create two new virtual devices on the status page.

Copy complete script above.
Create an event, recurring, i.e: every 60 seconds
Add Action: run script
Create new one.
Name: i.e: Youless.vb
Open script window
Paste complete script and change ip address and both device codes A8 and A9 two new device codes you earlier created.
My home automation blog: https://rutg3r.com
yellowbird
Starting Member
Starting Member
Posts: 2
Joined: Tue Feb 21, 2012 2:43 pm

Re: YouLess LS110 Energy Monitor

Post by yellowbird »

Rutger wrote:Hi Yellowbird,

Thnx for your script.
My counter have 3 digits behind the komma.
The youless counter is on 29661,544 kWh.
In Homeseer I see the value 296615. Your script have the komma 1 place too far to the right?
Do you have the same experience?
I assumed a fixed length for the total energy usage and it showed Wh instead of kWh, mine is just turned on since yesterday so I have very low kWh number. Here is an updated version that I think should solve it and also display the value in kWh.



Imports System.Net

Sub Main(parm as object)
Dim strUrl As String = "http://192.168.1.230/a?f="
Dim devIdCurrent As String = "A8"
   Dim devIdTotal As String = "A9"

Dim request As WebRequest = WebRequest.Create(strUrl)
Dim response As WebResponse = request.GetResponse()
Dim data as String = new System.IO.StreamReader(response.GetResponseStream()).ReadToEnd()

Dim s1 As Integer
Dim e1 As Integer
   Dim current As Integer
   Dim total As Double

s1 = data.IndexOf("pwr") + 5
e1 = data.IndexOf(",", s1)

current = Convert.ToInt32(data.SubString(s1,e1 - s1))

hs.SetDeviceValue(devIdCurrent, current)
hs.setdevicestring(devIdCurrent, current.ToString() & "W")

s1 = data.IndexOf("cnt") + 6
e1 = data.IndexOf("pwr", s1) - 3

total = Convert.ToDouble(data.SubString(s1,7).Replace(",",""))/1000

hs.SetDeviceValue(devIdTotal , total)
hs.setdevicestring(devIdTotal , total.ToString() & "kWh")
End Sub
freakstar
Member
Member
Posts: 118
Joined: Thu Sep 22, 2011 4:07 pm

Re: YouLess LS110 Energy Monitor

Post by freakstar »

How do i configure the virtual devices?
Rutger
Member
Member
Posts: 339
Joined: Wed May 19, 2010 8:48 pm
Location: Netherlands

Re: YouLess LS110 Energy Monitor

Post by Rutger »

On your status page where all devices are visible, click on the left top on 'add device' and configure as you can see in the screenshot. Room and Floor will be different ofcourse.
No other configuration is necessarry. For the Youless script from Yellowbird, you'll have to add two virtual devices, like YL_Current and YL_Total.
The devicevalue and devicestatus will be updated when the script runs.
Attachments
newdevice.jpg
newdevice.jpg (37.23 KiB) Viewed 30586 times
My home automation blog: https://rutg3r.com
freakstar
Member
Member
Posts: 118
Joined: Thu Sep 22, 2011 4:07 pm

Re: YouLess LS110 Energy Monitor

Post by freakstar »

Trying to get this script back to work after an stupid delete action...

Created an event with the following script:

Code: Select all

Imports System.Net

Sub Main (parm as Object)
	Dim strUrl As String = "http://192.168.1.9/a?f=" 
	Dim devIdCurrent As String = "Y1"
	Dim devIdTotal As String = "Y2"

	Dim request As WebRequest = WebRequest.Create(strUrl) 
	Dim response As WebResponse = request.GetResponse()
	Dim data As String = new System.IO.StreamReader(response.GetResponseStream()).ReadToEnd()

	Dim s1 As Integer
	Dim e1 As Integer
	Dim current As Integer
	Dim total As Double

	s1 = data.IndexOf("pwr") + 5
	e1 = data.IndexOf(",", s1) 

	current = Convert.ToInt32(data.SubString(s1,e1 - s1))

	hs.SetDeviceValue(devIdCurrent, current)
	hs.setdevicestring(devIdCurrent, current.ToString() & "W")

	s1 = data.IndexOf("cnt") + 6
	e1 = data.IndexOf("pwr", s1) - 3 

	total = Convert.ToDouble(data.SubString(s1,7).Replace(",",""))/1000

	hs.SetDeviceValue(devIdTotal , total)
	hs.setdevicestring(devIdTotal , total.ToString() & "kWh")
End Sub
Created two "Status only" devices Y1 and Y2 for the values. When I run the script my HS log says:
Running script, script run or compile error in file: GetPwr1006:Expected ')' in line 3 More info: Expected ')'

Overlooked the script now like 10 times but can't find this fault?
freakstar
Member
Member
Posts: 118
Joined: Thu Sep 22, 2011 4:07 pm

Re: YouLess LS110 Energy Monitor

Post by freakstar »

Ah ja het truukje was opslaan als .vb...
nikagl
Member
Member
Posts: 54
Joined: Sun Jun 20, 2010 9:30 pm

Re: YouLess LS110 Energy Monitor

Post by nikagl »

De code bevat nog een foutje volgens mij. Je pakt de substring fixed 7 lang bij het totaal gebruik. Dit zou e1 - s1 moeten zijn om de lengte van de string te krijgen...

Code: Select all

Imports System.Net

Sub Main (parm as Object)
	Dim strUrl As String = "http://192.168.1.9/a?f="
	Dim devIdCurrent As String = "v4"
	Dim devIdTotal As String = "v5"
	
	Dim request As WebRequest = WebRequest.Create(strUrl)
	Dim response As WebResponse = request.GetResponse()
	Dim data As String = new System.IO.StreamReader(response.GetResponseStream()).ReadToEnd()
	
	Dim s1 As Integer
	Dim e1 As Integer
	Dim current As Integer
	Dim total As Double
	
	s1 = data.IndexOf("pwr") + 5
	e1 = data.IndexOf(",", s1)
	
	current = Convert.ToInt32(data.SubString(s1,e1 - s1))
	
	hs.SetDeviceValue(devIdCurrent, current)
	hs.setdevicestring(devIdCurrent, current.ToString() & " Watt")
	
	s1 = data.IndexOf("cnt") + 6
	e1 = data.IndexOf("pwr", s1) - 3
	
	total = Convert.ToDouble(data.SubString(s1,e1 - s1).Replace(",",""))/1000
	
	hs.SetDeviceValue(devIdTotal , total)
	hs.setdevicestring(devIdTotal , total.ToString() & " kWh")
End Sub
En voor degenen die deze code gebruiken, niet vergeten:
  • virtual devices aanmaken voor current en total
  • ip adres veranderen in youless ip-adres (192.168.1.9 vervangen)
  • v1 en v2 veranderen in de codes van jouw virtual devices
  • script plaatsen in scripts folder
  • event aanmaken dat script iedere X minuten runt
  • advies: zorg ervoor dat het event niet logt, anders heb je bij iedere execute een regel dat hij het script start
Voor dit alles ook nog even wat screenprints toegevoegd. Misschien handig voor diegenen die het willen gebruiken maar niet weten hoe...

Groet,

Nika.
Attachments
7. Event Trigger.png
7. Event Trigger.png (13.94 KiB) Viewed 30535 times
6. Event Properties.png
6. Event Properties.png (20.02 KiB) Viewed 30535 times
5. Virtual Device YouLess Total Options.png
5. Virtual Device YouLess Total Options.png (16.53 KiB) Viewed 30535 times
4. Virtual Device YouLess Total Config.png
4. Virtual Device YouLess Total Config.png (14.56 KiB) Viewed 30535 times
3. Virtual Device YouLess Current Options.png
3. Virtual Device YouLess Current Options.png (13.29 KiB) Viewed 30535 times
2. Virtual Device YouLess Current Config.png
2. Virtual Device YouLess Current Config.png (20.57 KiB) Viewed 30535 times
raymonvdm
Senior Member
Senior Member
Posts: 1153
Joined: Sun Dec 18, 2011 1:23 am

Re: YouLess LS110 Energy Monitor

Post by raymonvdm »

I just added this script to my HomeSeer and it is working fine :D

I also use two scripts to create a day usage counter (script was used for the NorthQ before, maybe it it not completely working due to DeviceString versus DeviceValue issues)

This one copies the current usage to another virtual device (running at 23:59)

Code: Select all


Sub Main(parm as object)
hs.SetDeviceString("K74", hs.DeviceString("K76") )
hs.SetDeviceLastChange("K74",now)
End Sub

This one calculates the usage of the last 24 hours using the value saved in the day before (running at 23:54)

Code: Select all


Sub Main(parm as object)
hs.SetDeviceString("K73", CStr( hs.DeviceValue("K76") - hs.DeviceString("K74") ) /100 )
hs.SetDeviceLastChange("K73",now)
End Sub


My devices are

Code: Select all


YouLess_Total_Day_Usage	  0	                Beganegrond	Meterkast	YouLess_Total_Day_Usage	        K73	Status Only	 Today 23:05:50	
Youless_Total_Yesterday	  39825,715 kWh 	Beganegrond	Meterkast	Youless_Total_Yesterday	        K74	Status Only	 Today 23:06:55	
YouLess Current	          696 Watt         	Beganegrond	Meterkast	YouLess Current	                K75	Status Only	 Today 23:12:26	
YouLess Total	          39825,786 kWh	        Beganegrond	Meterkast	YouLess Total	                K76	Status Only	 Today 22:52:26

Running HS3PRO on PC with Z-Wave / OpenTherm / Plugwise / RFXcom / MQTT / XAP400 / Logitech Media Server and Squeezelite on PI`s
freakstar
Member
Member
Posts: 118
Joined: Thu Sep 22, 2011 4:07 pm

Re: YouLess LS110 Energy Monitor

Post by freakstar »

Made some changes to get the script ready for HomeSeer 3:

Code: Select all

Imports System.Net

Sub Main (parm as Object)
   Dim strUrl As String = "http://192.168.1.14/a?f="
   Dim devIdCurrent As String = "117"
   Dim devIdTotal As String = "120"
   
   Dim request As WebRequest = WebRequest.Create(strUrl)
   Dim response As WebResponse = request.GetResponse()
   Dim data As String = new System.IO.StreamReader(response.GetResponseStream()).ReadToEnd()
   
   Dim s1 As Integer
   Dim e1 As Integer
   Dim current As Integer
   Dim total As Double
   
   s1 = data.IndexOf("pwr") + 5
   e1 = data.IndexOf(",", s1)
   
   current = Convert.ToInt32(data.SubString(s1,e1 - s1))
   
   hs.SetDeviceValue(devIdCurrent, current)
   hs.SetDeviceString(devIdCurrent, current & " Watt", True)
   
   s1 = data.IndexOf("cnt") + 6
   e1 = data.IndexOf("pwr", s1) - 3
   
   total = Convert.ToDouble(data.SubString(s1,e1 - s1).Replace(",",""))/1000
   
   hs.SetDeviceValue(devIdTotal , total)
   hs.SetDeviceString(devIdTotal , total & " kWh", True)
End Sub
Using the Reference ID to point to the virtual devices, don't know what to use to get it working with the Technology Address attribute?
raymonvdm
Senior Member
Senior Member
Posts: 1153
Joined: Sun Dec 18, 2011 1:23 am

Re: YouLess LS110 Energy Monitor

Post by raymonvdm »

I migrated to HS3 and these are my YouLess Scripts the last one is working fine now the other two in need to verify


These are the scripts

Maak_Nachtstand_Youless.vb

Code: Select all

Sub Main(parm as object)
hs.SetDeviceValue("449", hs.DeviceValue("448") )
hs.SetDeviceLastChange("449",now)
End Sub

Maak_Verbruik_Youless.vb

Code: Select all

Sub Main(parm as object)
hs.SetDeviceValue("450", CStr( hs.DeviceValue("448") - hs.DeviceValue("449") ) )
hs.SetDeviceLastChange("450",now)
End Sub
youless_update_HS3.vb

Code: Select all

Imports System.Net

Sub Main (parm as Object)
   Dim strUrl As String = "http://192.168.140.150/a?f="
   Dim devIdCurrent As String = "447"
   Dim devIdTotal As String = "448"
   
   Dim request As WebRequest = WebRequest.Create(strUrl)
   Dim response As WebResponse = request.GetResponse()
   Dim data As String = new System.IO.StreamReader(response.GetResponseStream()).ReadToEnd()
   
   Dim s1 As Integer
   Dim e1 As Integer
   Dim current As Integer
   Dim total As Double
   
   s1 = data.IndexOf("pwr") + 5
   e1 = data.IndexOf(",", s1)
   
   current = Convert.ToInt32(data.SubString(s1,e1 - s1))
   
   hs.SetDeviceValue(devIdCurrent, current)
   hs.SetDeviceString(devIdCurrent, current & " Watt", True)
   
   s1 = data.IndexOf("cnt") + 6
   e1 = data.IndexOf("pwr", s1) - 3
   
   total = Convert.ToDouble(data.SubString(s1,e1 - s1).Replace(",",""))/1000
   
   hs.SetDeviceValue(devIdTotal , total)
   hs.SetDeviceString(devIdTotal , total & " kWh", True)
End Sub
Running HS3PRO on PC with Z-Wave / OpenTherm / Plugwise / RFXcom / MQTT / XAP400 / Logitech Media Server and Squeezelite on PI`s
raymonvdm
Senior Member
Senior Member
Posts: 1153
Joined: Sun Dec 18, 2011 1:23 am

Re: YouLess LS110 Energy Monitor

Post by raymonvdm »

Is there somebody with a little more scripting experience who can fix the first two scripts for me. I want to create a value each night around 23:59 and extract the next night value from it to get a day usage of the last day
Running HS3PRO on PC with Z-Wave / OpenTherm / Plugwise / RFXcom / MQTT / XAP400 / Logitech Media Server and Squeezelite on PI`s
egbertje
Starting Member
Starting Member
Posts: 24
Joined: Tue Apr 03, 2012 11:07 am

Re: YouLess LS110 Energy Monitor

Post by egbertje »

This is an old topic but i am totally new to Homeseer and i have a problem with this script.

It all works but when i want to log the data for example to use in Jon00 database or in Imperihome or in Device history, nothing will be logged.
I think the problem is that there is coming no data in the Value field , only in the "string" field, and the plugins get the data from the Value.
Is this possible to change something in this script?
Homeseer 3 on andere Intel Nuc/Win10
Plugins Imperihome Jowihue Rfxcom Pushover P1
RFXcom V3 Visonic Powermax+ some KaKu
User avatar
erwindr
Starting Member
Starting Member
Posts: 5
Joined: Mon May 09, 2011 10:46 pm

Re: YouLess LS110 Energy Monitor

Post by erwindr »

I think the problem is that there is coming no data in the Value field , only in the "string" field, and the plugins get the data from the Value.
Is this possible to change something in this script?
The device string is set correctly, but the value is indeed empty. Just a small change in the syntax.
Edit this:

hs.SetDeviceValue(devIdCurrent, current)
to
hs.SetDeviceValueByRef(devIdCurrent, current, true)

and

hs.SetDeviceValue(devIdTotal , total)
to
hs.SetDeviceValueByRef(devIdTotal , total, true)
HS3 Pro 3.0.0.298, W10 on Atom x5-Z8300
SqueezeBox, UltraM1G3, UltraMon3, Z-Wave

HS2 Pro 2.5.0.80, W2k3 on AMD X2
X10 CM11A/CM12U, SqueezeB, UltraMon, tenHsPower, UltraM1G, SqueezeBox
djanssen
Starting Member
Starting Member
Posts: 1
Joined: Wed Sep 19, 2018 3:25 pm

Re: YouLess LS110 Energy Monitor

Post by djanssen »

Hi there,

This is my script that I use to have current and total kWh values in Homeseer 3.

Is there anybody who have added also his gas meter reading in HS3 with a Youless monitor and is willing to share his script for this?

Maybe some other scripts for HS3 like last day usage / current day usage that are used are welcome as well

Daan
Post Reply

Return to “Energycontrol & Home Automation Forum”