Replies: 9 comments
-
Your function only returns something when percent is > 0. It does not do anything when percent is 0, which is why PixelIt shows the last value > 0. I would add some debug statements using node.warn, to figure out the code flow and the contents of msg.payload and percent. |
Beta Was this translation helpful? Give feedback.
-
Thanks, I appreciate the input. Do you have any suggestion on how to make
it work the way I would like it to? I want the screen out of the rotation
when the value is 0.
…On Wed, Nov 16, 2022 at 3:06 AM hamster65 ***@***.***> wrote:
Your function only returns something when percent is > 0. It does not do
anything when percent is 0, which is why PixelIt shows the last value > 0.
—
Reply to this email directly, view it on GitHub
<#231 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGAWQ7ZIITHEB5D6G66B7ILWISIWZANCNFSM6AAAAAASBP25KM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I assume your value is in msg.payload at the beginning? var percent = msg.payload; if (percent > 0) { |
Beta Was this translation helpful? Give feedback.
-
Awesome! Thanks!
|
Beta Was this translation helpful? Give feedback.
-
Hi! i'm trying to get my solar information from HA to my clock. It works sometimes but only get undefined as information. This is what I have: Solar total HA is just a number represtenting watts. with function node:
I'm doing it wrong but have no idea, any suggestions? |
Beta Was this translation helpful? Give feedback.
-
I don't know if it matters, but I have screen init prior to text. Swap that, then put a debug module after text and see what it's spitting out. Your function code looks like it should work to me. |
Beta Was this translation helpful? Give feedback.
-
Thanks! Swapped it and used the debug node. Its spitting out a value. What should be the 'Text' in the last text node? Clock shows icon and as value undefined. EDIT: got it, should be {{payload}} |
Beta Was this translation helpful? Give feedback.
-
{{msg.payload}} |
Beta Was this translation helpful? Give feedback.
-
Hi! I was reading this thread and I am interested to see the results in your screen. Can you share a picture or short video pleas? |
Beta Was this translation helpful? Give feedback.
-
I have several screens working and all based on a value. Let's take solar power as an example. I want it to update and show the solar watts from panels only above 0 watts. When it is 0 watts, I want it to not show in the rotation. I mostly have it working, but instead of going away at 0, it reads the last value forever which is normally 1 watt. I noticed this is possible from the 'days til christmas" screen but can't duplicate it. I am pulling the values from MQTT, is that the problem?
I am using a function node with this code:
`var percent = msg.payload
msg.payload = percent;
if (percent === 0) {
msg.show = false
}
else if (percent > 0) {
return msg;
}`
Beta Was this translation helpful? Give feedback.
All reactions