LightwaveRF Binding Updated

@Fixer Yes there were only a few channels compared to the other bits, think I got them all.
Noticed something very strange today aswell… all my new sockets I bought Before Xmas have the energy/power/voltage channels set as writable. Seems there must be a bug lw end, my existing ones are not writable on them channels (checked them all in postman)

@Greigc I haven’t seen that error before… in the things file try increasing the timeout for all the things (may be that it’s too short and the system can’t return values in the time period)

looks like some of the features for the heating were causing it - I added them one by one until i had what I needed. Just need to figure out how to get a “£” at the front of “enegry cost” now.

This is great, Im going to eventually have a tablet in my hallway with the HABpanel running with weather and hopefully the ring camera setup.

Thanks for this and your help getting it all running!

The script is adding a null at the end of heatstate:

Switch Lightwave_Heating_heatState "Heating heatState" <switch> (Lightwave_Heating,GroupLightwave_Heating_heatState) null

Also, I don’t think the line:

var Number RefreshRateTimeout = RefreshRate -1

is working, as the line that goes into the things file contains:

Thing exec:command:LwGet [ command=“sh /openhab/conf/scripts/Lw_Get.sh %2$s”, interval=10,timeout=-1, autorun=true ]

@Greigc you can add it to the widget in habpanel or you can go into the items file (Lw_Items) and for energy add a £ sign in front of The % sign in the square brackets, and for power before it says /per hour
It won’t carry the £ sign over for some reason (sure I had this working before so I need to backtrack through previous versions

@xela I’ll have a look and post a fix shortly

@Greigc I think this is why you got the error

Sorry!

I should’ve fully tested and collated my responses…

The setting of the targettemp doesn’t seem to multiple the received command by 10, I’ve altered to

LwUpdate_Inp.sendCommand("5df8b6728522075debd21ad8-91-3157346060+1 " + Access_Token.state.toString + " " + (receivedCommand as DecimalType * 10).toString)

Had a feeling it might need this

Oh and I’m just setting up a dev environment so I can attempt to make a binding from all this, documentation is flakey at best though for a beginner so bear with me

Yeah, I’ll be honest, I looked at it and gave in pretty quickly :rofl:

One more unimportant one,

Is your intention that:

logInfo("Lw.Rules","Refresh Token Changed To " + Refresh_Token)

really be

logInfo("Lw.Rules","Refresh Token Changed To " + RefreshToken)

or even

logInfo("Lw.Rules","Refresh Token Changed To " + Refresh_Token.state.toString)

I’ve changed it in previous versions of the rules file, but never quite sure if it’s what you originally intended :slight_smile:

Here’s an example from mine on the kind of formatting you can do in the items file including how to add the £ sign where needed

Number Lightwave_CraftRoomLight_power “Craft Room Light Power [%.1f W]” (FF_CraftRoom)

Number Lightwave_CraftRoomLight_energy “Craft Room Light Energy [%.2f KwH]” (FF_CraftRoom)

Number Lightwave_CraftRoomLight_Power_Cost “Craft Room Light Power Cost [%.3f £/Hour]” (FF_CraftRoom)

Number Lightwave_CraftRoomLight_Energy_Cost “Craft Room Light Energy Cost [£ %.2f to date]” (FF_CraftRoom)

Did it not add the Alexa endpoint to the end?
Can you also post me the temperature lines

Number Lightwave_Heating_temperature “Heating temperature [%.1f �C] (Read Only)” (Lightwave_Heating,GroupLightwave_Heating_temperature) {alexa=“TemperatureSensor.temperature”}

String Lightwave_Heating_temperature_Lock

Number Lightwave_Heating_targetTemperature “Heating targetTemperature [%.1f �C]” (Lightwave_Heating,GroupLightwave_Heating_targetTemperature) {alexa=“ThermostatController.targetSetpoint”}

Group GroupLightwave_Heating_targetTemperature"Heating" {alexa=“Endpoint.Thermostat”}

String Lightwave_Heating_targetTemperature_Lock

Dimmer Lightwave_Heating_valveLevel “Heating valveLevel” (Lightwave_Heating,GroupLightwave_Heating_valveLevel)

String Lightwave_Heating_valveLevel_Lock

Switch Lightwave_Heating_heatState “Heating heatState” (Lightwave_Heating,GroupLightwave_Heating_heatState) null

String Lightwave_Heating_heatState_Lock

Number Lightwave_Heating_batteryLevel “Heating batteryLevel [%.1f %%] (Read Only)” (Lightwave_Heating,GroupLightwave_Heating_batteryLevel)

String Lightwave_Heating_batteryLevel_Lock

String Lightwave_Heating_rssi “Heating rssi (Read Only)”

String Lightwave_Heating_rssi_Lock

Switch Lightwave_Heating_callForHeat “Heating callForHeat (Read Only)” (Lightwave_Heating,GroupLightwave_Heating_callForHeat)

String Lightwave_Heating_callForHeat_Lock

Number Lightwave_Heating_Power_Cost “Heating Power Cost [%.3f Per Hour]” (Lightwave_PowerCost)

Number Lightwave_Heating_Energy_Cost “Heating Energy Cost [%.2f to date]” (Lightwave_EnergyCost)

@xela @Greigc try this new version and post me your thermostat items again so i can check its how it needs to be. should fix your errors now at least fingers crossed

Fixed currency and degrees for power/energy/temp
Fixed authentication format specifier not found

Lw_Base_v2-6_2020-01-13.rules.txt (38.7 KB)

If you downloaded any versions yesterday they prob won’t work (you can replace the authentication rule to fix this from this version) or just rerun setup

Number Lightwave_Heating_temperature “Heating temperature [%.1f °C] (Read Only)” (Lightwave_Heating,Lightwave_Heating) {alexa=“TemperatureSensor.temperature”}

String Lightwave_Heating_temperature_Lock

Number Lightwave_Heating_targetTemperature “Heating targetTemperature [%.1f °C]” (Lightwave_Heating,Lightwave_Heating) {alexa=“ThermostatController.targetSetpoint”}

Group GroupLightwave_Heating"Heating" {alexa=“Endpoint.Thermostat”}

String Lightwave_Heating_targetTemperature_Lock

Dimmer Lightwave_Heating_valveLevel “Heating valveLevel” (Lightwave_Heating,Lightwave_Heating)

String Lightwave_Heating_valveLevel_Lock

Switch Lightwave_Heating_heatState “Heating heatState” (Lightwave_Heating,Lightwave_Heating) {alexa=“Endpoint.Switch”}

String Lightwave_Heating_heatState_Lock

Number Lightwave_Heating_batteryLevel “Heating batteryLevel [%.1f %%] (Read Only)” (Lightwave_Heating,Lightwave_Heating)

String Lightwave_Heating_batteryLevel_Lock

String Lightwave_Heating_rssi “Heating rssi (Read Only)”

String Lightwave_Heating_rssi_Lock

Switch Lightwave_Heating_callForHeat “Heating callForHeat (Read Only)” (Lightwave_Heating,Lightwave_Heating)

String Lightwave_Heating_callForHeat_Lock

Number Lightwave_Heating_Power_Cost “Heating Power Cost [%.3f £/Per Hour ]” (Lightwave_PowerCost)

Number Lightwave_Heating_Energy_Cost “Heating Energy Cost [£%.2f to date]” (Lightwave_EnergyCost)

I still have issues with your authentication code, I generally simplify it to

rule LwAuth when System started or Time cron “30 0 0 1/1 * ? *” or Item Authentication_Switch changed from OFF to ON then
var String Authentication = “curl -X POST https://auth.lightwaverf.com/v2/lightwaverf/autouserlogin/lwapps -H Content-Type:application/json -H x-lwrf-appid:ios-01 -d {"email":"” + username + “","password":"” + password + “"}”
LwAuth_Inp.sendCommand(Authentication)
LwAuth_Run.sendCommand(ON)
logInfo(“Lw.Rules”,“Authentication Rule Ran”)
Authentication_Switch.sendCommand(OFF)
end

Line 410:

if(Features_Writable == “true” &&

Needs to be

else if(Features_Writable == “true” &&

otherwise the targetemperature rule gets caught again by one of the later if’s

@xela Try this one.
Fixed Auth Rule error (else argument missing {}
Modified Groups slightly
Fixed if to else if

Lw_Base_v2-7_2020-01-14.rules.txt (38.7 KB)

Looking good so far, will abuse it a bit more this evening and let you know if I find anything

Can you include “productCode”: “L22MK2”, in the dimmer group, this is the Smart 2 gang dimmers, I would assume there is L23MK2 and L24MK2 but I don’t own any of those :slight_smile:

@xela I got the product codes off of Lws website, wish they would document everything correctly as im pissing in the wind a little with things like that. I had added the L21MK2 as it was in @Fixer json he sent me, have just added the others for you, hopefully i didnt break anything else :slight_smile:

Lw_Base_v2-7-1_2020-01-14.rules.txt (38.8 KB)

@Greigc my habpanel at present (scales to tablet) but far from finished (only used when out of house remotely, haven’t got round to wall mounts yet)