Originally posted by mikee123
View Post
Cheers
Al
If this is your first visit, be sure to check out the FAQ. You must register before you can post.
IMPORTANT: Your first post will be checked for appropriate content. This may take a bit of time.
energy_name = devt.Replace("Watts","")
dim array_energy() as string = {"Watts Blue lights right","Watts Blue lights left","Watts Satellite","Watts GreenIQ","Watts Sauna TV","Watts Projector","Watts Brick Lights","Watts Uplighters","Watts Water feature pump","Watts Water feature lights","Watts Artcoustic","Watts TV Sim","Watts tablet charger lounge","Watts tablet charger kitchen","Watts TAG","Watts Chromecast","Watts TV","Watts GC100","Watts iPod","Watts SKY"} dim watts as decimal = 0 dim consumption as decimal = 0 dim energy_name as string = "" dim energystr as string = "" sub Main(ByVal Parms as Object) 'Option Strict Off Try energy_name = "" energystr = "" for each devt as string in array_energy watts = hs.DeviceValueByNameEx(devt) If watts > 0 energy_name = devt energystr = energystr & energy_name & " <span style='color:blue'>" & watts & "</span>" & "<br>" consumption = consumption + watts End If next hs.SetDeviceString(612, energystr,true) Catch ex As Exception hs.WriteLog ("Array", "Error: " & ex.Message) End Try End Sub
consumption = hsgetdevicevaluebyref(1) + hsgetdevicevaluebyref(2) + ...
consumption = hs.devicevalueEx(1) + hs.devicevalueEx(2) + ...
Leave a comment: