X10 dimmer control script CM11 and CM15Pro
Posted: Saturday 14 May 2016 7:43
I have been using X10 devices for years, starting with the CM11 and later the CM15Pro controlled from domoticz.
I have mainly 2 way swtiches and dimmers but it is a pitty that mochad cannot decode the dimmer signals and keep track of the dimmer status in domoticz. (and runing on a synology gave me even more trouble with mochad, so added a RasPi3 to run my X10 PL devices)
Recently I got my old CM11 out again and also hooked it up to domotiz next to the CM15Pro, advantage of the CM11 is that with Heyu you can request the RAW dimmer setting from the command line. so with Lua you can store this value and use this in domotizc.
The engine only tracks this properly for the dimmers in the housecode, so i re-asigned the dimmers all to G as the housecode to track the dimmer status.
You have to track this in raw mode, since the % mode is not linear with the raw mode, i.e. Raw 0=0% , 1 = 12%, raw 61=98% and raw 63=100% so you cannot just map the range with a math function.. you need to track the raw but need to keep the dimmer in % for domoticz
I now use 1 switch directly controlled by the CM15Pro, a virtual dimmer to use on my frontpage so I can control it as a normall dimmer, and an additional switch to track if the dimmer was changed manually, otherwise the scripts start acting on changes from one script to the other
in this example the dimmer is called Keuken (kitchen in dutch) what is the real X10 device on G1
I added 2 swtiches:
KeukenVirtual = a virtual dimmer that is used on my frontpage to control the light
KeukenManuel = a on / off switch to track if the switch is changed by the scripts or not
KeukenDim = a user variable to store the RAW dimmer value when setting through domoticz and when reading back
here the lua scripts for the dimmer
next there I added a script to check the status of the dimmer when it is on, so in case you change it manually by the push buttons it will also store the value. this is a time base lua script.
checks if the timmer is not off and if so stores the RAW value in the uservariable KeukenDim
I will expand this to all my dimmers at home and if still working properly, it could be added to the wiki.
improvement needs to be made to not have all names hardcoded but put them in an overview at the start of the scripts so they are easier to change for other users
I have mainly 2 way swtiches and dimmers but it is a pitty that mochad cannot decode the dimmer signals and keep track of the dimmer status in domoticz. (and runing on a synology gave me even more trouble with mochad, so added a RasPi3 to run my X10 PL devices)
Recently I got my old CM11 out again and also hooked it up to domotiz next to the CM15Pro, advantage of the CM11 is that with Heyu you can request the RAW dimmer setting from the command line. so with Lua you can store this value and use this in domotizc.
The engine only tracks this properly for the dimmers in the housecode, so i re-asigned the dimmers all to G as the housecode to track the dimmer status.
You have to track this in raw mode, since the % mode is not linear with the raw mode, i.e. Raw 0=0% , 1 = 12%, raw 61=98% and raw 63=100% so you cannot just map the range with a math function.. you need to track the raw but need to keep the dimmer in % for domoticz
I now use 1 switch directly controlled by the CM15Pro, a virtual dimmer to use on my frontpage so I can control it as a normall dimmer, and an additional switch to track if the dimmer was changed manually, otherwise the scripts start acting on changes from one script to the other
in this example the dimmer is called Keuken (kitchen in dutch) what is the real X10 device on G1
I added 2 swtiches:
KeukenVirtual = a virtual dimmer that is used on my frontpage to control the light
KeukenManuel = a on / off switch to track if the switch is changed by the scripts or not
KeukenDim = a user variable to store the RAW dimmer value when setting through domoticz and when reading back
here the lua scripts for the dimmer
- Spoiler: show
next there I added a script to check the status of the dimmer when it is on, so in case you change it manually by the push buttons it will also store the value. this is a time base lua script.
checks if the timmer is not off and if so stores the RAW value in the uservariable KeukenDim
- Spoiler: show
I will expand this to all my dimmers at home and if still working properly, it could be added to the wiki.
improvement needs to be made to not have all names hardcoded but put them in an overview at the start of the scripts so they are easier to change for other users