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


  • 2

HC3 and MQTT in QA


Guest kallecux

Question

Guest kallecux

Hello! - Happy Easter!

 

I try to play with the new MQTT-functionality in QA's, but im am not successful.

There i have a MQTT broker on Hassio and this code on HC3:

 

Please login or register to see this code.

When i save the QA i get this message on HC3:

[13.04.2020] [13:33:33] [DEBUG] [QUICKAPP353]: onConnected: {"sessionPresent":false,"returnCode":0}

 

The Broker says this:

1586777612: New connection from 192.168.3.116 on port 1883.
[INFO] found hc3 on Home Assistant
1586777613: New client connected from 192.168.3.116 as randomjdtfpexjvy (p2, c0, k0, u'hc3')

 

So i think everything is OK, but i get no:

- onSubscribeMessage when the QA started

- onPublished Message when i toggle the switch 

 

Is there anybody who can give me a hint?

Thanks in advance.

Karl Heinz 

 

Edited:

When i toggle the QA Switch, the message is transferred to the broker and the other clients (NodeRed-Cient), but the function onPublished is NOT called! 

I think the callback / envent is not executed, so i can not get the subscribed data. :-(

 

Edited by kallecux
Link to comment
Share on other sites

Recommended Posts

  • 0

I have a problem now with receiving the values of the lamp. 

If I manually enter a value, for example 20,  both sliders with the ID's Brightness and Hue are going to this value.

 

Please login or register to see this code.

 

 

But when I want to try to do this automatically then only the first in the row are working:

 

Please login or register to see this code.


 

This is the same with the print command, I see only the value of the first in the row.

I'm convinced there's a way to get this right, but I can't figure it out.

 

 


 

Please login or register to see this code.

 

Edited by Firepeet
Link to comment
Share on other sites

  • 0
23 hours ago, Firepeet said:

I have a problem now with receiving the values of the lamp. 

If I manually enter a value, for example 20,  both sliders with the ID's Brightness and Hue are going to this value.

 

Please login or register to see this code.

 

 

But when I want to try to do this automatically then only the first in the row are working:

 

Please login or register to see this code.


 

This is the same with the print command, I see only the value of the first in the row.

I'm convinced there's a way to get this right, but I can't figure it out.

 

 


 

Please login or register to see this code.

 

 

Sorry for the quick response from my side, but is there someone who can kick me to the right way?

My brains are exploded? ?

Link to comment
Share on other sites

  • 0
9 hours ago, Firepeet said:

 

Sorry for the quick response from my side, but is there someone who can kick me to the right way?

My brains are exploded? ?

 

What value range is payload.hue ?

Sliders usually takes 0-99

Link to comment
Share on other sites

  • 0
38 minutes ago, Firepeet said:

Value range of hue is 0 - 359. I know that i have to devide the value with 3.59. 
 

 

self:updateView("Color","max","359")

Link to comment
Share on other sites

  • 0
5 hours ago, jgab said:

self:updateView("Color","max","359")

 

Thanks, but this doen't solve my problem.

The strange thing is that only the top line of tostring(payload....) works.

 

With the 2 codes below only Dimming works with the top one, and with the bottom one only Color works.

 

Please login or register to see this code.

 

----------------------------------------------

 

Please login or register to see this code.

 

 

[23.06.2022] [15:26:04] [DEBUG] [QUICKAPP203]: Received message: {"state":"ON","brightness":0,"color_temp":370,"bulb_mode":"white","color":{"r":255,"g":255,"b":255}}

[23.06.2022] [15:26:04] [DEBUG] [QUICKAPP203]: Received message: {"state":"OFF","mode":0,"bulb_mode":"scene","color":{"r":255,"g":255,"b":255}}

[23.06.2022] [15:26:20] [DEBUG] [QUICKAPP203]: Received message: {"hue":120}

[23.06.2022] [15:26:20] [DEBUG] [QUICKAPP203]: Received message: {"state":"ON","brightness":232,"bulb_mode":"color","color":{"r":0,"g":255,"b":0}}

[23.06.2022] [15:26:28] [DEBUG] [QUICKAPP203]: Received message: {"brightness":46}

[23.06.2022] [15:26:29] [DEBUG] [QUICKAPP203]: Received message: {"state":"ON","brightness":46,"bulb_mode":"color","color":{"r":0,"g":255,"b":0}}

Edited by Firepeet
add console information
Link to comment
Share on other sites

  • 0
On 6/23/2022 at 1:35 PM, Firepeet said:

 

Thanks, but this doen't solve my problem.

The strange thing is that only the top line of tostring(payload....) works.

 

With the 2 codes below only Dimming works with the top one, and with the bottom one only Color works.

 

Please login or register to see this code.

 

----------------------------------------------

 

Please login or register to see this code.

 

 

[23.06.2022] [15:26:04] [DEBUG] [QUICKAPP203]: Received message: {"state":"ON","brightness":0,"color_temp":370,"bulb_mode":"white","color":{"r":255,"g":255,"b":255}}

[23.06.2022] [15:26:04] [DEBUG] [QUICKAPP203]: Received message: {"state":"OFF","mode":0,"bulb_mode":"scene","color":{"r":255,"g":255,"b":255}}

[23.06.2022] [15:26:20] [DEBUG] [QUICKAPP203]: Received message: {"hue":120}

[23.06.2022] [15:26:20] [DEBUG] [QUICKAPP203]: Received message: {"state":"ON","brightness":232,"bulb_mode":"color","color":{"r":0,"g":255,"b":0}}

[23.06.2022] [15:26:28] [DEBUG] [QUICKAPP203]: Received message: {"brightness":46}

[23.06.2022] [15:26:29] [DEBUG] [QUICKAPP203]: Received message: {"state":"ON","brightness":46,"bulb_mode":"color","color":{"r":0,"g":255,"b":0}}

 

The bug as described

Please login or register to see this link.

is still not fixed.

All updateView commands are not working in the UI of the code editor. They are working only correctly outside the editor.

 

But it's still strange that tostrings(payload.xxx) commands are stop working when they have a calculation in it. For example tostring((payload.hue)*3.59).

The line with the calculation are working, but all other updateView lines below that one are not.

 

Link to comment
Share on other sites

  • 0
12 hours ago, Firepeet said:

 

The bug as described

Please login or register to see this link.

is still not fixed.

All updateView commands are not working in the UI of the code editor. They are working only correctly outside the editor.

 

But it's still strange that tostrings(payload.xxx) commands are stop working when they have a calculation in it. For example tostring((payload.hue)*3.59).

The line with the calculation are working, but all other updateView lines below that one are not.

 

You can't set the slider value to a decimal value.

Link to comment
Share on other sites

  • 0
2 hours ago, jgab said:

You can't set the slider value to a decimal value.

That doesn't apply in my situation. It concerns variable values that come in via an external remote control.

Link to comment
Share on other sites

  • 0

Ok, but tostring((payload.hue)*3.59) *always* works if payload.hue has a number value.

Show us some code with debug statements that does otherwise...

Link to comment
Share on other sites

  • 0
2 hours ago, jgab said:

Ok, but tostring((payload.hue)*3.59) *always* works if payload.hue has a number value.

Show us some code with debug statements that does otherwise...

 

 

Here the full code.

after I turned on the lamp, I first operated the color slider. This one works.  But the Brightness slider doesn't work after that.

When I switch those 2 lines, brightness works and color doesn't.

 

Please login or register to see this code.

 

 

Debug:

 

[25.06.2022] [11:44:55] [DEBUG] [QUICKAPP203]: 1 on
[25.06.2022] [11:44:55] [DEBUG] [QUICKAPP203]: Received message: {"state":"ON"}
[25.06.2022] [11:44:56] [DEBUG] [QUICKAPP203]: Received message: {"state":"ON","brightness":97,"color_temp":205,"bulb_mode":"white","color":{"r":255,"g":255,"b":255}}
[25.06.2022] [11:45:03] [TRACE] [QUICKAPP203]: UIEvent: {"elementName":"Color","deviceId":203,"values":[58],"eventType":"onChanged"}
[25.06.2022] [11:45:03] [DEBUG] [QUICKAPP203]: Colorvalue : 58
[25.06.2022] [11:45:04] [DEBUG] [QUICKAPP203]: Received message: {"hue":58}
[25.06.2022] [11:45:04] [DEBUG] [QUICKAPP203]: payload_hue: 58
[25.06.2022] [11:45:04] [DEBUG] [QUICKAPP203]: Received message: {"state":"ON","brightness":217,"bulb_mode":"color","color":{"r":255,"g":253,"b":196}}
[25.06.2022] [11:45:12] [TRACE] [QUICKAPP203]: UIEvent: {"elementName":"Dimming","deviceId":203,"values":[45],"eventType":"onChanged"}
[25.06.2022] [11:45:12] [DEBUG] [QUICKAPP203]: Brigntnessvalue : 45
[25.06.2022] [11:45:12] [DEBUG] [QUICKAPP203]: Received message: {"brightness":46}
[25.06.2022] [11:45:13] [DEBUG] [QUICKAPP203]: Received message: {"state":"ON","brightness":46,"bulb_mode":"color","color":{"r":255,"g":253,"b":196}}
[25.06.2022] [11:49:18] [TRACE] [QUICKAPP203]: UIEvent: {"elementName":"button_1_off","deviceId":203,"values":[null],"eventType":"onReleased"}
[25.06.2022] [11:49:18] [DEBUG] [QUICKAPP203]: 1 off
[25.06.2022] [11:49:18] [DEBUG] [QUICKAPP203]: Received message: {"state":"OFF"}
[25.06.2022] [11:49:19] [DEBUG] [QUICKAPP203]: Received message: {"state":"OFF","brightness":46,"bulb_mode":"color","color":{"r":255,"g":253,"b":196}}

 

Please login or register to see this attachment.

Link to comment
Share on other sites

  • 0

Ok, there are some issues....

First, I don't see the debug messages you have in the code. I see 'Received message:' but not the self:debug('payload_hue

later in your QuickApp:myCallBack.

Have you edited the log?

 

Secondly

Please login or register to see this code.

will update the slider with a numeric value - you need to convert the whole value to a string

Please login or register to see this code.

etc.

 

and why 

Please login or register to see this code.

twice?

 

Then, have you adjusted the max values of the sliders - seems like values can be > 99 now.

 

Finally, beware when updating a slider with a value that doesn't arrive with the message - like kelvin

Edited by jgab
  • Like 1
Link to comment
Share on other sites

  • 0
8 hours ago, jgab said:

Ok, there are some issues....

First, I don't see the debug messages you have in the code. I see 'Received message:' but not the self:debug('payload_hue

later in your QuickApp:myCallBack.

Have you edited the log?

 

Secondly

Please login or register to see this code.

will update the slider with a numeric value - you need to convert the whole value to a string

Please login or register to see this code.

etc.

 

and why 

Please login or register to see this code.

twice?

 

Then, have you adjusted the max values of the sliders - seems like values can be > 99 now.

 

Finally, beware when updating a slider with a value that doesn't arrive with the message - like kelvin

 

The log is not edited. This is the debug of payload_hue:

[25.06.2022] [11:45:04] [DEBUG] [QUICKAPP203]: payload_hue: 58

 

Thanks, this solved some issues:

Please login or register to see this code.

 

Kelvin is the ID of the Temperature / Saturation slider. 

This slider has 2 functions. If color is selected, this slider will be set the saturation value. If white is selected, the temperature value will be set with this one.

Whitevalue is responsible for this. value 1 is white, value 0 is color. Maybe it's better that I put an IF THEN  ELSE for both self:updateView("Kelvin" rows.

 
Anyway, I'm a little further ahead. Huge thanks for this??
Link to comment
Share on other sites

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...