Closed MattL0 closed 4 years ago
what's your use case for this?
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.
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?
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.
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.
@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.
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.
@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.
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.
@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.
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.
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.
I will add a "sync" as well as a "report" topic., and probably a setting in the HS Device node to sync on startup.
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.
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.
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.