load from light realy

Hi, i tried to find some other topic similar but i dind’t
i have a couple of fibaro 1x2.5 relay
can i use them to calculate the load? i know the load when the light is on so it could be possible to add them in the whole total

If you define a serviceId of [tt]urn:micasaverde-com:serviceId:EnergyMetering1[/tt] and variable named [tt]UserSuppliedWattage[/tt] set to the expected load, then the actual Watts variable will be set to that when the device is turned on, and back to zero when turned off.

Stupid question… How can define a service id? Can you please give me also an example with a device id 40 for example

Not stupid at all - the UI is so awful you couldn’t be expected to find it easily (I take it you are on UI7)

Two ways:

  1. Apps > Develop Apps > Test Luup code, just cut and paste and run this code (changing to the 100 to the wattage you need)
luup.variable_set ("urn:micasaverde-com:serviceId:EnergyMetering1", "UserSuppliedWattage", 100, 40)
  1. From the device panel you need > Advanced > New service

…and type the values into the boxes and press Add.

Just horrible, isn’t it?

ok my id is 50 and my watt is 100
i added in the lua
luup.variable_set (“urn:micasaverde-com:serviceId:EnergyMetering1”, “UserSuppliedWattage”, 100, 50) → ok for lua code

in the device i added:
new service UserSuppliedWattage
new variable UserSuppliedWattage
new value 100

nothing happened, i reloaded the engine and i found 2 variables with the same name and same values. is it a problem?
how can i remove one variable??

anyway it works!

These were two alternatives, but you used both!

So long as it works, then no problem - I’m a bit concerned that you can have two identical variables - you’re sure you used the same serviceId for both?

Deleting variables is MUCH harder than creating them, so just forget it.

i didnt understand two ways, just read it again…
i restore a backup…
thanks a lot, i think i will ask a lot of times and hope to answer to someone a couple at least…