- Platform information:
- OS: Ubuntu LTS - Debian bullseye/sid
- Java Runtime Environment: 8u201-1~webupd8~1
- openHAB version: 2.5.9-1
PROBLEM: I am unable to set value of Dimmer Device from Dimmer Switch in Rule
Could someone help me with the correct syntax (to write a dimmer value to a Dimmer)
I have a Phillips HUE Dimmer switch working (Zigbee)
PaperUI shows the dimmer status is working - 1 produces 100% and dimmer up/down works, 0 = Off
I have a Smart Home Zigbee Dimmer Device - Zigbee (connected to some downlights)
PaperUI shows the device is controllable - sliding the Dimmer 0 to 100% is working perfectly.
Now to connect the Dimmer switch to the Dimmer Unit using a rule
I understand my problem is a mismatch of types, as a test, I was originally trying to control my LIFX lights which want HSB and soon realised I was out of my depth (thank you @rlkoshak for all your tutorials). I have forged ahead as I assumed connecting Dimmer to Dimmer I would not have to deal with transforming the data…but…
Following is my rule which at least Visual Studio seemed happy with, but still produces an error …
rule "React on Level Control (PhilipsRWL02123736_LevelControl) change/update"
when
Item PhilipsRWL02123736_LevelControl changed
then
SmartHomeDELXN56DS27LX13_LevelControl.sendCommand(PhilipsRWL02123736_LevelControl)
end
Pressing the button on the HUE Switch, produced the following log…
==> /var/log/openhab2/events.log <==
2020-11-23 22:14:39.098 [vent.ItemStateChangedEvent] - PhilipsRWL02123736_LevelControl changed from 6 to 0
==> /var/log/openhab2/openhab.log <==
2020-11-23 22:14:39.099 [WARN ] [rthome.model.script.actions.BusEvent] - Cannot convert ‘PhilipsRWL02123736_LevelControl’ to a state type which item ‘SmartHomeDELXN56DS27LX13_LevelControl’ accepts: [PercentType, OnOffType, UnDefType].
I initially tried to set the Dimmer form the Switch by the action:
SmartHomeDELXN56DS27LX13_LevelControl = PhilipsRWL02123736_LevelControl
But this produces…
==> /var/log/openhab2/events.log <==
2020-11-23 22:33:32.459 [vent.ItemStateChangedEvent] - PhilipsRWL02123736_LevelControl changed from 8 to 9
==> /var/log/openhab2/openhab.log <==
2020-11-23 22:33:32.459 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘React on Level Control (PhilipsRWL02123736_LevelControl) change/update’: An error occurred during the script execution: Cannot assign a value in null context.
I apologise, but this is a bit beyond me. I have tried combinations of sendCommand postUpdate. The most simplest action produces a similar error.
How would I read the Dimmer switch and postUpdate that in the correct format?
The switch gives me a 0-100 which I think openhab treats as a percentage
The Dimmer requires…
SmartHomeDELXN56DS27LX13_LevelControl’ accepts: [PercentType, OnOffType, UnDefType].
Instead of…
`postUpdate(SmartHomeDELXN56DS27LX13_LevelControl, PhilipsRWL02123736_LevelControl)`
Is it something like
`postUpdate(SmartHomeDELXN56DS27LX13_LevelControl, [PhilipsRWL02123736_LevelControl,,])`
Thanks in advance for some help
Ian