X10 Dimmers; A simple solution

Moderator: leecollings

User avatar
Thuis
Posts: 251
Joined: Tuesday 11 September 2018 11:36
Target OS: Linux
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: X10 Dimmers; A simple solution

Post by Thuis »

Is that a question to me? on github ?
I Love Domoticz ! And the community around it :-)
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: X10 Dimmers; A simple solution

Post by waltervl »

No just an extra remark and confirmation to the developers that it is not working anymore as before.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
Thuis
Posts: 251
Joined: Tuesday 11 September 2018 11:36
Target OS: Linux
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: X10 Dimmers; A simple solution

Post by Thuis »

Ah ok, thanks for backing it up !
I Love Domoticz ! And the community around it :-)
User avatar
Thuis
Posts: 251
Joined: Tuesday 11 September 2018 11:36
Target OS: Linux
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: X10 Dimmers; A simple solution

Post by Thuis »

Well i have tested the new script from github, and it works. But it gives an error in the log.

Code: Select all

EventSystem: in script_device_dimmers:[string "commandArray = {}..."]:22: bad argument #1 to 'pairs' (table expected, got nil)
Status: User: admin (IP: xxx.xxx.xxx.xxx) initiated a switch command (172/Lamp Aanrecht/Set Level)
Status: LUA: idx: 172, name: Lamp Aanrecht, state: On, svalue: 30, nvalue: 2
Status: LUA: /home/onshuis/Domotica/domoticz/scripts/lua/mochad_dim.sh J3 18 
I see the light dim and brighten and go on and off so it all works, but the error.

I have no clue what it means. But the script seems to work!
Do you know perhaps a solution to the bad argument?
I Love Domoticz ! And the community around it :-)
User avatar
Thuis
Posts: 251
Joined: Tuesday 11 September 2018 11:36
Target OS: Linux
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: X10 Dimmers; A simple solution

Post by Thuis »

Ok i put

Code: Select all

if (devicechanged_ext ~= nil) then
in front of line 22, and the error is gone.
So thanks all is working now :-)

So to update the forum post, the changed script from Gizmocuz on github is this:

Code: Select all

commandArray = {}

local BASHSCRIPT = "/home/pi/domoticz/scripts/lua/mochad_dim.sh "  --keep the space at the end!

local bashcall = ""
dimmers = {}

-- Dimmer names must be strictly identical to the dimmer labels
dimmers["Lumiere Salon"]="o4"
dimmers["Lumiere Salle a Manger"]="o6"
dimmers["Lumiere Chambre 1"]="o8"
dimmers["TestDimmer"]="o10"
dimmers["TestSwitch"]="o11"
dimmers["Lumiere Bureau"]="o12"
dimmers["Lumiere Chambre 3"]="o13"

if (devicechanged_ext ~= nil) then
for name,value in pairs(devicechanged_ext) do
	if (name == "name") then
		local X10Address=dimmers[value]
		--If a registered Dimmer
		if X10Address ~= nil then
			-- Create appropriate way to call the BASH script
			local state = devicechanged_ext["state"];
			local level = tonumber(devicechanged_ext["svalue"]);

			print ("idx: "..devicechanged_ext["idx"]..", name: "..devicechanged_ext["name"]..", state: "..state..", svalue: "..tostring(level)..", nvalue: "..devicechanged_ext["nvalue"]);

			if state == "Off" then
				bashcall=BASHSCRIPT ..X10Address.." ".. "Off"
			elseif state == "On" then
				if (level == 0) then
					bashcall=BASHSCRIPT ..X10Address.." ".. "On"
				else
					local intdata=(tostring(math.floor(level*0.63)))
					bashcall=BASHSCRIPT..X10Address.." "..intdata    	    
				end
			end
			--Call the Bash script
			--os.execute(bashcall)		        
			print(bashcall);
		end
	end
end
end
return commandArray
And is working as a tierelier. Thanks to gizmocuz and waltervl for helping me.
I Love Domoticz ! And the community around it :-)
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: X10 Dimmers; A simple solution

Post by waltervl »

To be clear, to use this new script you have to update domoticz to the latest beta version 15095 or higher.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
Thuis
Posts: 251
Joined: Tuesday 11 September 2018 11:36
Target OS: Linux
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: X10 Dimmers; A simple solution

Post by Thuis »

waltervl wrote: Thursday 23 February 2023 17:16 To be clear, to use this new script you have to update domoticz to the latest beta version 15095 or higher.
Yes thanks, it was clear.
I Love Domoticz ! And the community around it :-)
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: X10 Dimmers; A simple solution

Post by waltervl »

Thuis wrote: Thursday 23 February 2023 17:17
waltervl wrote: Thursday 23 February 2023 17:16 To be clear, to use this new script you have to update domoticz to the latest beta version 15095 or higher.
Yes thanks, it was clear.
To you probably it was clear but not for the other users that will have the same problem and read this thread :-)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
Thuis
Posts: 251
Joined: Tuesday 11 September 2018 11:36
Target OS: Linux
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: X10 Dimmers; A simple solution

Post by Thuis »

You are right again :D
I Love Domoticz ! And the community around it :-)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest