Selector switch

Python and python framework

Moderator: leecollings

Post Reply
Tonio16
Posts: 45
Joined: Friday 23 February 2018 20:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: France
Contact:

Selector switch

Post by Tonio16 »

Hello

I want to modify a selector switch in domoticz. This switch is created with this command:

Code: Select all

Option1 = {"Scenes": "|||||", "LevelNames": "0|Vent. 1|Vent. 2|Vent. 3|Vent. red.", "LevelOffHidden": "false", "SelectorStyle": "1"}
Domoticz.Device(Name="Pui. Vent. en cours",  Unit=17, Type=244, Subtype=62 , Switchtype=18, Options = Option1, Used=1).Create()#1066
It should changed the power of my ventillation.

If I change the level in domoticz, I have this log:

Code: Select all

User: Admin initiated a switch command (115/vmc - Pui. Vent. en cours/Set Level)
But the level stays the same, checked with print in log, and so it's not updating the ventillation.

I think I miss something but I don't find.

I am updating a thermostat without troubles with the same script.

Tx for your help or comments


Antoine
Tonio16
Posts: 45
Joined: Friday 23 February 2018 20:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: France
Contact:

Re: Selector switch

Post by Tonio16 »

Me again.
I tried to modify the level with a json. Though there is no error message, no change of the selector switch.

This switch can only be changed by the python plugin. Is it normal?

Antoine
pipiche
Posts: 2016
Joined: Monday 02 April 2018 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: France
Contact:

Re: Selector switch

Post by pipiche »

The way to change a Selector Switch from a LUA script is for example based on that syntax.
I don't if it helps, but here after is a LUA script which Set a selector switch (controling a cooling equipment).

Code: Select all

	if ( otherdevices['Clim Chambre Power'] == 'On' and ( hoursnow >= 21 or hoursnow <= 8 )) then
		if ( hoursnow == 21 ) then
			if ( otherdevices_svalues['Clim Chambre Mode'] ~= '30' ) then 
				print('21h Set Mode set to 30 (Cold) from ' .. otherdevices_svalues['Clim Chambre Mode'] )
				--commandArray['Clim Chambre Mode'] = 'Set Level: 30'  
                		commandArray[#commandArray +1]={['Clim Chambre Mode']='Set Level: 30'}
			end         -- Mode Clim/Cold
			if ( otherdevices_svalues['Clim Chambre Ventillation'] ~= '70' ) then 
				print('21h Set Mode Ventillation speed to 70 (Level5) from ' .. otherdevices_svalues['Clim Chambre Ventillation'] )
				--commandArray['Clim Chambre Ventillation'] = 'Set Level: 70'  -- Level 5
                		commandArray[#commandArray +1]={['Clim Chambre Ventillation']='Set Level: 70'}
			end -- Fan at Max
			--commandArray['SetSetPoint:428'] = '18' -- Set Temp to 18°
                	commandArray[#commandArray +1]={['SetSetPoint:428']='18'}
		end  -- 21h00 to 21h59
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices

If the plugin provides you value, you can support me with a donation Paypal.

Wiki is available here.

Zigbee for Domoticz FAQ
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest