Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Possibility to send the value of a device when Nodered start. #3

Closed
MattL0 opened this issue Aug 6, 2020 · 16 comments
Closed
Labels
enhancement New feature or request

Comments

@MattL0
Copy link

MattL0 commented Aug 6, 2020

Having the possibility to autosend the value from a device to node red when nodered start would be useful. So the user could decide if they want the value updated

-when the device changed , and also when nodered starts.
-when the device changed, but NOT when nodered starts.
-when the device update , and also when nodered starts.
-When the device update, but NOT when nodered starts.

@MattL0 MattL0 changed the title Possibility to send the value of a device when nodered start. [ENHANCEMENT] Possibility to send the value of a device when Nodered start. Aug 6, 2020
@MattL0 MattL0 changed the title [ENHANCEMENT] Possibility to send the value of a device when Nodered start. [Enhancement] Possibility to send the value of a device when Nodered start. Aug 6, 2020
@spudwebb
Copy link
Collaborator

what's your use case for this?

@Enigmatheatre
Copy link

I would also like to see this as when you create a UI in Node-Red or have another program connected to it and you shut down node-red and the devices change in HS it is not updated on startup so the data that is held is wrong until the device changes value.
Another situation is if my system restarts and HS is up before Node-Red and a device changes it is not updated on startup in Node-red.

@spudwebb
Copy link
Collaborator

spudwebb commented Sep 4, 2020

I see, so what about adding a new "sync" topic, i.e if a HS Device node receives msg.topic: "sync", then the node would get the current status/value from HS, update the node status next to the yellow dot, and propagate the status/value to the flow.
Would that work for you?

Note that in the current implementation, at startup the current status is retrieved from HS and the node status is updated, but not propagated to the flow. So, node status should already be ok, can you confirm this what you see?

@Enigmatheatre
Copy link

Yes, I believe the node has the correct value but we need a way to update the flow so the items are in sync. What you are suggesting would work as we could use payload = Started! in an inject node to trigger the sync on startup but it would be much better if there was a checkbox in the node to update the flow on startup so we did not need to add an inject node to do this and it was part of the HS node settings.

@KSumwalt
Copy link

KSumwalt commented Sep 4, 2020

Would Context Stores work for you? https://nodered.org/docs/user-guide/context Persistent Context saved to a file and therefore available on a reboot of Node Red.

@Enigmatheatre
Copy link

@KSumwalt this could be done but is a lot of work. I am trying to make the HS node as user friendly as possible without requiring the use of other nodes to make it function.

@KSumwalt
Copy link

KSumwalt commented Sep 4, 2020

After re-reading this, since the HomeSeer devices are up to date, why not start any flow that would require the "sync" on startup? https://cookbook.nodered.org/basic/trigger-on-start
It just takes using an Inject node configured to fire on start. To do this, check the box for "Inject once after __ seconds" and set the second to something great enough to allow for HomeSeer and anything else needed to boot.

To me, ease of use means consistency within the platform. This being Node Red. If I went to the Node Red Slack or Stack Exchange and asked how to make this happen, I believe I would get the above solution. Which is a solution which works for other nodes outside HomeSeer as well.

@Enigmatheatre
Copy link

@KSumwalt
You have just repeated what I posted above! I said that this would work with an inject node set to Startup! but only if they had the "Sync" option but at the moment there is no way to do this.
Personly I see easy as not having to go to Node Red Slack or Stack Exchange and ask a question if there is a tick box or an explanation in the help of the node on how "Sync" would work to do this.

@KSumwalt
Copy link

KSumwalt commented Sep 4, 2020

Did a little more investigation. The Status Node can be triggered when HomeSeer changes a device's status. Since this occurs even during startup, it can be used to send the value to a flow. You just need to set a payload based on the status text and add it to the appropriate place in the fow. See my post describing using this to keep a Dashboard UI sync'd with HomeSeer in the HomeSeer forums.

@Enigmatheatre
Copy link

@spudwebb
I think your "sync" topic is the best Idea and if this can be implemented would do as I require.

@KSumwalt
OK, that works for that situation but I need 5 nodes for each of my 20 devices and all my UI is display only so it is only changed from HS and not node Red so can not be synced without many extra nodes.

@pseudocoder
Copy link

pseudocoder commented Sep 7, 2020

Another scenario is just wanting a node to send its status as a message, without necessarily needing a sync.

I suggest at the same time adding a "report" topic that skips the querying HomeSeer part but does send out the status.

@KSumwalt
Copy link

KSumwalt commented Sep 7, 2020

Guess I am just amazed that we are discussing a programming platform and do not want to set a variable to be read later nor, apparently, use built in capabilities. I am not trying to be argumentative and if I come across as such, I apologize. I am only trying to suggest that there are ways to get the end result and that there is something to be said for being consistent with other items which may be in our flows. Such as thermostats, vacuums, and other items not supported by HomeSeer nor the various plugins.

@Enigmatheatre are you sure you wouldn't need only 5 nodes total for all the On/Off devices? Plus a single Change node for eaach different type of item passed such as one change for all the Dimmable devices to pass the dim level? I posted a follow-up which added a few more devices and only a\one Switch Node to send the payload to the proper UI item. So my single example is not repeated for each item. I respect your coding capabilities and suspect you may have realized this, but the support person in me can't make that assumption. I also do not know exactly what your flow is so I could be in a different direction.

@spudwebb spudwebb added the enhancement New feature or request label Sep 7, 2020
@spudwebb
Copy link
Collaborator

spudwebb commented Sep 7, 2020

I will add a "sync" as well as a "report" topic., and probably a setting in the HS Device node to sync on startup.

@KSumwalt
Copy link

KSumwalt commented Sep 8, 2020

How about the ability to get a list of all HomeSeer devices and then poll or control them? If I want to control all devices in a given room, category, floor or combination? Get me a list of the devices and their current values. Make it more dynamic as opposed to me needing to add/remove items manually.

@spudwebb
Copy link
Collaborator

In version 1.0.4 I added a "sync" and a "report" option for msg.topic, as well as a "Report state on startup" setting in the HS Device node config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants