Hello
I have a few automations in node-red using bigtimer as the trigger. Their is an option in bigtimer to input ON OFF AUTO I would like to add some buttons to lovelace ui to these inputs but cant quite get my head around input boolean or scripts. Has anyone done this and some pointers or step by steps would be great help thanks.
An input boolean is either on or off. That’s it. You simply create an input boolean
Or you can use an MQTT switch to pass one of 2 states, and you decide what the states are:
Or you can use an input select and have a dropdown with as many options as you would like:
I don’t think a script fits into this scenario at all. What part are you confused about?
What part are you confused about?
Adding a button in lovelace to trigger a node-red flow
I have looked at the input select but the examples I made keep throwing an error in check config
Thanks
Do I need to make a automation ? to trigger the node-red flow ?
OK this is what I would like to do in the node-red flow (screen shot below) I want to add the inputs as buttons in lovelace IU
Any help would be great
Thanks
You need to create the switch or input select in your configuration yaml. Then restart home assistant. Then use the event state node in node red to read the state of the button when it changes.
First things first, you have to create the switch.
No. Creating an automation in HA just to trigger an automation in node red is a silly idea.
Just create the switch, add it to the frontend, and use the event state node to read the state. That’s it.
Do you want three different buttons or just one drop-down box that gives you 3 options?
I would like to try both options and figure out which works best most likely drop down box
I will try to create a switch as my input select options (going from examples) keeps throwing errors in check-config (i’m obviously doing it wrong LOL). Any way your help @flamingm0e is much appreciated
Those errors aren’t just eye candy. They actually mean something. What errors do you see? Are you sure you’re formatting correctly? Spacing is correct? In the right spot?
I’m just starting over again step by step to see where errors are most likely formatting but I haven’t worked that out yet
Sorry @flamingm0e do I need to create a light switch or just a switch (cant find switch only Template Switch)
OK added this to config :
light:
- platform: switch
name: Morning Lights
entity_id: switch.morning_lights
but getting :
‘Invalid config for [switch]: required key not provided @ data[‘platform’]. Got None. (See /config/configuration.yaml, line 451). Please check the docs at https://home-assistant.io/components/switch/’
OK @flamingm0e making some progress
added to config file
Test light
light:
- platform: template
lights:
morning_lights:
friendly_name: “morning lights”
turn_on:
#
turn_off:
#
and have working UI switch with trigger in node-red but only have on and off is their any option to switch to auto ?
If not will look into further but a big thanks @flamingm0e made some good progress
Still think you should use an input select. Try this in your config.yaml:
input_select:
morning_lights:
name: Morning Lights
options:
- 'On'
- 'Off'
- 'Auto'
initial: 'Off'
This should give you a dropdown on your UI like below:
You’ll need to do something like this in Node red:
[{"id":"e9f30cd6.ff394","type":"server-state-changed","z":"801174eb.98e1c8","name":"","server":"b9ff79d7.164bf8","version":1,"entityidfilter":"input_select.morning_lights","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":260,"y":860,"wires":[["57639f23.927b9"]]},{"id":"57639f23.927b9","type":"switch","z":"801174eb.98e1c8","name":"On/Off/Auto?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"On","vt":"str"},{"t":"eq","v":"Off","vt":"str"},{"t":"eq","v":"Auto","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":570,"y":860,"wires":[[],[],[]]},{"id":"b9ff79d7.164bf8","type":"server","z":"","name":"Home Assistant"}]
And add whatever actions you want for the three connections on the switch.
Input Boolean, or MQTT switch…
No. Not a light…
If you want more than 2 states…use an input select…or 3 different switches.
Event state node…
Node red is actually extremely easy to use and debug.
Add an event state node, point it to your input select, attach it to a debug node, set the debug node to entire message, not just msg.payload. Now change your input select from the HA GUI…
You need to start with debugging nodes if you don’t know what data is coming out of the entity. You can’t expect it to know exactly what you want. You have to give it the data.
Hi thanks but im getting
“TypeError: Cannot read property ‘addListener’ of undefined”
on the events: state node
I managed to add input select
You’re pointing to an entity that doesn’t exist.
But did you point it directly to the entity?
Thats where im going wrong I think
it worked as a switch but how to add as entity