Jump to content

Question

Can someone help me with Node-Red?

 

I need to tell node-Red to change a global value in HC2.

 

Thanks for the Help

Link to post
Share on other sites

13 answers to this question

Recommended Posts

  • 0

node-red-contrib-fibaro-hc2

0.0.75

but this version still in development. no ETA. sorry

 

but you can use simple flow

 

[{"id":"c4cdbe4c.c1dba","type":"http request","z":"66b2aa16.b03184","name":"HC2: set global","method":"PUT","ret":"obj","url":"http://192.168.1.36/api/globalVariables/{{{topic}}}","tls":"","x":660,"y":320,"wires":[["5b95809f.d03c"]]},{"id":"5b95809f.d03c","type":"debug","z":"66b2aa16.b03184","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":850,"y":320,"wires":[]},{"id":"264c340d.44157c","type":"change","z":"66b2aa16.b03184","name":"do not touch","rules":[{"t":"set","p":"payload","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"payload.name","pt":"msg","to":"topic","tot":"msg"},{"t":"set","p":"payload.value","pt":"msg","to":"value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":320,"wires":[["c4cdbe4c.c1dba"]]},{"id":"aa1ac1c7.272a9","type":"inject","z":"66b2aa16.b03184","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":320,"wires":[["b14bb006.b56ff"]]},{"id":"b14bb006.b56ff","type":"change","z":"66b2aa16.b03184","name":"change me!","rules":[{"t":"set","p":"topic","pt":"msg","to":"Test","tot":"str"},{"t":"set","p":"value","pt":"msg","to":"Ololo","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":320,"wires":[["264c340d.44157c"]]}]

 

do not forget chage HC Ip address + set basic auth 

 

Link to post
Share on other sites
  • 0

Hi there!

 

Do you have newer information to modify a global variable via node red?

 

Greetings!

Karl Heinz 

Link to post
Share on other sites
  • 0

todo plan

 

1) fix reconenction on network errors

2) set global vars

 

when? maybe ath this weekend.

Link to post
Share on other sites
  • 0

yes

oops: UPD no

only changed values :(

 

topic has name home/globalVariables

 

 

Edited by 10der
Link to post
Share on other sites
  • 0

hoi 10der

i am totally new with node-red but wanted to try your "simple" flow

i have set my ip and credentials like this

http://user:[email protected]/api/globalVariables/{{{topic}}}

where put i my global like for example the global in HC2 = marantz into this flow

 

is it also possible to put the payload directly into the global of HC2 for example if i say to google or alexa or siri set input marantz to hdmi2

Link to post
Share on other sites
  • 0

@Kage sorry, not sure what I right understand you

1st what url is? My not not required any http

2nd yes my node can’t change global var 

3d you can’t change global var if user is not admin

so, if you want to change global  var please simple create a new VD with button where you can. Change global var and call press this button from NodeRed

Link to post
Share on other sites
  • 0

thx for quick replay,

 

This is what i wanted to do,

say to Alexa "set volume to 40

i have a global named marantzVol 

and the payload is, when i say the line, 40

now when the payload is 40 that is what i wand into my global to HC2 😄

 

When i youse your flow as above you mention change ip and basic auth.

so i did like

http://user:[email protected]/api/globalVariables/{{{topic}}}

 

do i have to change de topic in this line or where do i put my global from HC2 in

 

 

 

I get the variable to change only it is the value that is given as Ololo.

now only if it can be the payload of ALexa

 

Edited by Kage
progress
Link to post
Share on other sites
  • 0

For what purposes you are trying to use HC?
node red has a native tons ready for use solution for Alexa/ sonos etc

its look like tripping from Ukraine Lviv to Poland Kraków (~300km) via for  example Los Angles 

Link to post
Share on other sites
  • 0

When i say the frase "Alexa set reciever at 40" than the global in HC2 have to change in 40, That triggers a scene that controls the Marantz.

 

For now i get it to work only for text not numbers

i change the text value Ololo into a msg whit value payload

than when i say a frease like "On" it change the global in HC to ON

but whit numbers only it will not work.......Yet

 

 

Link to post
Share on other sites
  • 0

HC2 (and not HC3) can hook parameters when you calling scenes 

why you use global s for it?!
just encode your parameters  to table and pass to call as last parameter 

in scene you can hook this parameters 

no global var at all

Link to post
Share on other sites
  • 0

i know it can be done by parameters directly into a scene but i am new with node-red and this is stap one 😁

 

its not only for the Marantz but this is de testcase for me now

 

so for completing the first stap, how can i change the number from Alexa into a text-value, 8 must be "8"

 

GOT IT!!😉

made a function with

var x = msg.payload;

if (x>0) {
 var msg_o = {payload : String(msg.payload)}

 

 

thx again

just playing with it, just raining outside

Edited by Kage
  • Thanks 1
Link to post
Share on other sites
  • 0

So global isn't a option because there is nog trigger if you work with startSource.

Then trigger it to startScene like 10der says. ☹️😊

Link to post
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...