zachowj / hass-node-red

Companion Component for node-red-contrib-home-assistant-websocket to help integrate Node-RED with Home Assistant Core
MIT License
465 stars 182 forks source link

Feature Request: Generate Virtual Switch for HASS #4

Closed Dodoooh closed 4 years ago

Dodoooh commented 4 years ago

thanks for your work

Would it be possible to include the function to generate a virtual switch? This feature would be very great. Currently I'm doing it with virtual switch in HASS

vajonam commented 4 years ago

It already does this.

https://community.home-assistant.io/t/node-red-contrib-home-assistant-websocket/71032/389?u=kermit

Dodoooh commented 4 years ago

Okay, sorry, I didn't know. But I need to customize the HASSIO config? with the web hook ID?

automation:
  trigger:
    platform: webhook
    webhook_id: some_hook_id

then it is almost easier and cleaner to create the virtual switches right in the config. or am I mistaking this?

zachowj commented 4 years ago

Can you explain a little more of what your use-case of a virtual switch is for? Are you talking about being able to create an input_boolean in HA from NR?

I don't fully follow your second comment.

Dodoooh commented 4 years ago

Exactly. I use them for example to interact with HomeKit (HomePod) in Node Red.

vajonam commented 4 years ago

The point as I understand it’s that you just put a webhook node in NR and it auto creates a webhook and plumbs then events so , if you post to the webhook it will show up in the node.

On Dec 17, 2019, at 3:12 PM, Dodoooh notifications@github.com wrote:

 Okay, sorry, I didn't know. But I need to customize the HASSIO config? with the web hook ID?

automation: trigger: platform: webhook webhook_id: some_hook_id then it is almost easier and cleaner to create the virtual switches right in the config. or am I mistaking this?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

vajonam commented 4 years ago

Also looks like your confusing the concepts. Webooks vs switches vs sensors.

This creates 3 things in HA

Webhooks Switches Sensors

On Dec 17, 2019, at 3:12 PM, Dodoooh notifications@github.com wrote:

 Okay, sorry, I didn't know. But I need to customize the HASSIO config? with the web hook ID?

automation: trigger: platform: webhook webhook_id: some_hook_id then it is almost easier and cleaner to create the virtual switches right in the config. or am I mistaking this?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Dodoooh commented 4 years ago

Okay, then it doesn't fully work for me.

When I create a sensor in Node Red, it is immediately displayed in HASS. But when I create a webhook in NR it does not appear in HASS.

the function to create switches from NR I don't have. it show to me only the sensor and webhook node.

Dodoooh commented 4 years ago

Okay, after several reboots and reinstallation, it works now. Please excuse the inconvenience and thank you very much for your help.

Dodoooh commented 4 years ago

It works really well, but what I unfortunately noticed is that the status (ON/OFF) of switches is lost during a reboot. Is there a way to save this?

vajonam commented 4 years ago

I am sure I tried this.. seemed to work and save it for me. I will try again.

On Wed, Dec 18, 2019 at 11:38 AM Dodoooh notifications@github.com wrote:

It works really well, but what I unfortunately noticed is that the status (ON/OFF) of switches is lost during a reboot. Is there a way to save this?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zachowj/hass-node-red/issues/4?email_source=notifications&email_token=AABFHNNTSCZ4T2XAEHWPXQDQZJGZTA5CNFSM4J4AI3O2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHGXCHQ#issuecomment-567111966, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABFHNOSZZ67RF3RU45LARTQZJGZTANCNFSM4J4AI3OQ .

zachowj commented 4 years ago

It works really well, but what I unfortunately noticed is that the status (ON/OFF) of switches is lost during a reboot. Is there a way to save this?

Switches will always restore their state from their status in NR whether it is disabled or enabled. Sensors require that the Resend state and attributes is checked for it to restore the last updated state from NR.

Created webhooks in NR won't show up under the integrations in HA.

vajonam commented 4 years ago

Switches will always restore their state from their status in NR whether it is disabled or enabled. Sensors require that the Resend state and attributes is checked for it to restore the last updated state from NR.

Makes sense, because my NR and HA run on different containers, I didn't notice reset on HA restart.