Updated Setup file
Added alexa endpoints for switches / heating
Added custom group names per device type
Added thermostats
Lw_Base_v2-2_2020-01-13.rules.txt (34.3 KB)
Yeah you need to use the latest file (if it’s not created the Lw_Get.sh file in your scripts folder)
If you hold off I’ll make the modification later today to pass your temps correctly.
@Greigc Could you pm me your items file for the energy monitor and your thermostat so I can add/make sure I’ve got all the channels as I don’t have the devices myself
New script sounds good, will be a good upgrade on mine, I’ll wait until you’ve fixed the temps before I grab it. i assume you’ll account for the *10 when setting the temp too?
@xela yes I’ll do both ways.
Should be up in the next 12 hours, got few bits got to do first for work
New Version 2.3:
Added correct thermostat channels
Fixed temperature display wrong
Tidied up items file as best as possible
***Please check updating the setpoint works as i’m unable to check due to not having a thermostat
***Also please check alexa endpoint for thermostat is correct
Lw_Base_v2-3_2020-01-13.rules.txt (38.5 KB)
Other bits to do:
Add homekit / google tags
let me know anything else you want
Thanks Dave, will load it this evening and test it all
Have you got the energy monitor integrated using the info I sent you previously?
@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)
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 ![]()
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 ![]()
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