Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

LUA to Read a Parameter Value from a Device


Question

Posted

Hi Everyone,

 

I have been adding Fibaro devices for many years in my home and finally have the time to begin some programming of scenes and QA's. I am a newbe in the programming area but very keen to learn.

I would like to read the value of a Fibaro Relay Switch in a QA

The device ID is 240 and the Parameter Value is 17 (Second Channel, time parameter for delay/auto on/off mode) which is 2 byte

I believe to change the value I use this,

 

hub.call(101,"setConfiguration",19,1,30)

where:

101 is the device-id

19 is the parameter to adjust

1 is the byte length

The new value is 30.

 

But I have no idea how to read the existing value?

 

Any help would be greatly appreciated.

 

Recommended Posts

  • 0
Posted
4 hours ago, MiZ said:

No difference in QA. Still no parameters printed?? Idea?

Not even one parameter?

  • 0
Posted

No. It just doesn't go into the "print parameter" loop, but it prints all the devices.

  • 0
Posted
1 minute ago, MiZ said:

No. It just doesn't go into the "print parameter" loop, but it prints all the devices.

What devices do you have? What types?

Check any device on your hub using the swagger..What do you see? Can you see something like this? Do they have recognizable parameters? Show me one example

 

Please login or register to see this attachment.

  • 0
Posted (edited)

I bet, your devices dont have parameter templates, so they dont have parameters table filled in device's JSON. So the parameters are empty tables. Like here

 

This is my other device, that has no template

 

Please login or register to see this attachment.

 

Edited by Neo Andersson
  • 0
Posted

At work right now, so cannot connect to Swagger. WIll send.

  • 0
Posted
19 minutes ago, MiZ said:

At work right now, so cannot connect to Swagger. WIll send.

Man, you dont need the swagger,,just chcek if any of your devices has parameter templates or not..Just chek it in web parameter's tab,

 

Please login or register to see this image.

/monthly_2024_09/image.png.8d8fc8829594d58eaf8fa82ba7aed2c5.png" />

 

 

 

or just chek one specific device using a lua code

 

 

 

Please login or register to see this code.

 

For now i am done, going to sleep..Tomorrow will help if still needed..But the code i gave you earlier should work. If it doesnt, your devices has no parameters,

  • 0
Posted

I just get "[]" as reply to "print(json.encode(dev.properties.parameters))"??

 

For example, device id 152 has a template and parameters:

Please login or register to see this attachment.

 

 

But when running this code:

Please login or register to see this image.

/monthly_2024_09/image.png.d8b8dd56559d1ef540997491dd2f383d.png" />

I get this output:

image.png.76cac6b68de0072da23f2319b94e5484.png

 

I have put this to Fibaro support, let's see what they say...

 

  • 0
Posted
1 hour ago, MiZ said:

I just get "[]" as reply to "print(json.encode(dev.properties.parameters))"??

 

For example, device id 152 has a template and parameters:

Please login or register to see this attachment.

 

 

But when running this code:

Please login or register to see this link.

I get this output:

Please login or register to see this link.

 

I have put this to Fibaro support, let's see what they say...

 

What is your Zwave engine? This is engine 3 right????

So it is in Beta,,dont use it, otherwise you can experience problems like this

  • 0
Posted

Where can I see the Zwave engine number/version?

  • 0
Posted

Please login or register to see this attachment.

 

 

With engine 3.0 your Z-Wave setup screen will look like this

  • 0
Posted

Yes it does like that.

 

Where can I change it? Have I selected v3 during config somewhere (can't remember I did)?

  • 0
Posted

When you started with your HC3 setup. 

 

You can only do a complete new setup, to get on the engine 2.0. 

  • 0
Posted

Ok, and should I at this point? What is your recommendation? Pros and cons? 

  • 0
Posted

It can be a lot of work to start over with you HC3. Depends on the amount of devices you have to disconnect and connect, scenes, scenarios, quickapps, etc. And it depend on how much issues you have right now (or don't want to have in the near future). 

 

  • 0
Posted
10 minutes ago, SmartHomeEddy said:

It can be a lot of work to start over with you HC3. Depends on the amount of devices you have to disconnect and connect, scenes, scenarios, quickapps, etc. And it depend on how much issues you have right now (or don't want to have in the near future). 

 

...and still the issue might not be solved? Or are you confident that engine 2 will solve this?

 

I have to google the differences between 2 and 3, I wasn't aware I made a choice during setup.

  • 0
Posted

I don't have engine 3.0 so I don't know what you are missing. But I am sure in my setup I can read the parameters of devices. That is why Neo was so surprised you couldn't find any parameters, none. 

 

(I had sort of the same issues with lastWorkingRoute and the neighborList for my Z-Wave Analyzer, they are in engine 3.0 in a different place.)

  • 0
Posted (edited)

If you dont have too many devices, it is worth to switch back to engine 2. It is in stable version, while engine 3 only god knows how long will stay in beta. And while in Beta, there can be countless problems that you can stumble upon.

And the asnwer to your question, YES on engine 2, you can get all parameters of devices that have template.

 

Edited by Neo Andersson

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...