NSPManager / NSPanelManager

Sonoff NSPanel custom firmware for responsive and intuitive use
https://nspanelmanager.com/
128 stars 10 forks source link

NSPanel Manager Scenes Functionality #16

Closed cablesandcoffee closed 2 months ago

cablesandcoffee commented 1 year ago

I think there could be two user solutions for scenes. Number 1 is the primary, nr 2 is nice but personally not a need.

1. For people that don't have scene solutions or think our solution is an easier way of working with scenes. There should be both Room Scenes and Home Scenes. Room Scenes saves light states for lights in a specific room. Home Scenes saves light states for all lights in the home.

In NSPanel Manager user should be able to name up to 4 room scenes/room and total of 4 home scenes. These should populate when user accesses the panels room scene page or home scene page which will consist of the scenes, a save button and and activate button.

When pressing save all current lights states in room/home will be saved to NSPanel Manager database. Pressing On Scene Name will collect the values from database and send it on the HA/OH websocket.

Topic to activate from outside Scenes created with number 1 solution should have a nice topic so that it is easy to activate the scene from HA/OH (maybe by voice) if user wants that ability.

2. For people who already have scene solutions set up in there smart home that they want to keep using. In this case the user should be able to call there scenes from the panel. Similar to adding lights to rooms they add there scenes to the scene page. If they have some kind of save switch, the could add this as well and all we would do would be to turn ON/OFF the exposed HA/OH switch.

tpanajott commented 1 year ago

I'm thinking that an implementation of this would be that all NSPM scenes could call on external scenes. This would make it possible to configure an empty scene that would just call a separate scene in Home Assistant or OpenHAB. Either that or simply that there are two modes.

1.

Scenes are handled by NSPM

2.

Connect the button for "scene 2" to a scene in Home Assistant/OpenHAB and have it trigger it. This would mean that you don't have to create "dummy"-scenes in order to trigger scenes already setup.

cablesandcoffee commented 1 year ago

Yes I think there should be 2 options as you say.

1 is for users not having any scene solution set up. This would be an easy way to get it.

2 is for users already having some kind of scene solution. An example could be users using zigbee2mqtt scene solution with an activate/save switch. Those users could add their Activate/Save switches just like Lights are added to the panel using the API.

tpanajott commented 1 year ago

TftDefines.h needs to be updated with NSPanel definitions such as names and IDs of components in order to progress further in the issue.

tpanajott commented 1 year ago

@cablesandcoffee, should the MQTT topic for activating/saving scenes states be based upon scene IDs or based on scene names? If we choose to use IDs the MQTT topic is maybe not so clear but you could have multiple scenes by the same name. If we choose to use names, we may run into problems using the same name of multiple scenes. For example, maybe a user wants an "Evening"-scene in every room. One solution if we choose the scene names is to make the topic something similar to nspanel/room/scene_name/activate

cablesandcoffee commented 1 year ago

I've updated the tftdefines file and the Hmi files. Tried to put in what I think you needed based on what you had in there before.

About the topics I think its good as you say to have the room or home in the topic. I personally think ids are better than having "friendly names". Then you can change the name of the scene without having to change any topics on the other side.

I think this would be good: nspanel/room1/scene_1/activate nspanel/room1/scene_2/activate nspanel/room2/scene_1/activate nspanel/room2/scene_2/activate nspanel/home/scene_1/activate nspanel/home/scene_2/activate

Another thing. The top left scenes button on first page needs to change pictures when toggling between room lights mode and all lights mode. I've added the pic and pic2 data in TFT defines.

cablesandcoffee commented 1 year ago

I just checked ZigBee2mqtt solution. There you create a group of lights and can create x amount of scenes. You name them by setting and Id and name. Topics look like this there: Topic zigbee2mqtt/lightgroup/set Value: {"scene_recall": 1} {"scene_store": {"ID": 1, "name": "Bedroom Erik Scene1 With there store solution you can actually create a scene that does not exist yet. Guess thats why they're using both id and name?

tpanajott commented 1 year ago

I think the solution for now will have to be something along the lines of:

I don't see a reason for a user to create a scene from the panel by entering a name. From what I see, the scene first has to be created in the NSPanelManager interface and then it will show up on the NSPanels themselves and be ready for use.

tpanajott commented 1 year ago

It looks like the Nextion file has the funtionality to show the "Scenes"-page when pressin the Scene-button. Could @cablesandcoffee please remove that? I need the button press to know when to update the Scenes-page.

cablesandcoffee commented 1 year ago

oh yes of course. Forgot that. Fixed it now! :)

tpanajott commented 1 year ago

@cablesandcoffee Basic functionality of scenes for rooms is now working. Would be glad if you could try it out and check that it works with OpenHAB as well.

There are still no global scenes.

cablesandcoffee commented 1 year ago

I think the solution for now will have to be something along the lines of:

  • nspanel/bedroom/scenes/1/activate sending a 1 on that topic will activate it.
  • nspanel/bedroom/scenes/1/save sending a 1 on that topic will save it with current states.

I don't see a reason for a user to create a scene from the panel by entering a name. From what I see, the scene first has to be created in the NSPanelManager interface and then it will show up on the NSPanels themselves and be ready for use.

I missed that you wrote this and I totally agree! Super easy to understand as well!

cablesandcoffee commented 1 year ago

@cablesandcoffee Basic functionality of scenes for rooms is now working. Would be glad if you could try it out and check that it works with OpenHAB as well.

There are still no global scenes.

Wow! So cool! Im updating now. Will force my roomie to try it cause I'm not home! :D

tpanajott commented 1 year ago

@cablesandcoffee Basic functionality of scenes for rooms is now working. Would be glad if you could try it out and check that it works with OpenHAB as well. There are still no global scenes.

Wow! So cool! Im updating now. Will force my roomie to try it cause I'm not home! :D

Ha, hopefully it works then! Remember that the scenes has to be created in the room page and then the panel has to be restarted.

tpanajott commented 1 year ago

Global scenes (scenes affecting all lights and switches) should work as of the latest devel commit.

tpanajott commented 11 months ago

@cablesandcoffee it would be great to be able to display/hide the "Save"-icon on the Scenes-page as they are currently now always shown. Am I missing something or are they not controllable/defined in the firmware?

cablesandcoffee commented 11 months ago

That is true, I will fix that. Plan forward is to have icons on all similar buttons instead of the way I've done it before. It's easier now when it's a solid background color.

cablesandcoffee commented 5 months ago

Long time since we wrote anything here. The icon stuff that you mentioned in July is obviously fixed now. From or initial plan for this functionality the only thing left would be the ability to activate a scene currently existing in HA or OH. Maybe we could close this one and open a new one that is more specific to that and we can discuss when and if we still want/need that feature?

tpanajott commented 2 months ago

Long time since we wrote anything here. The icon stuff that you mentioned in July is obviously fixed now. From or initial plan for this functionality the only thing left would be the ability to activate a scene currently existing in HA or OH. Maybe we could close this one and open a new one that is more specific to that and we can discuss when and if we still want/need that feature?

The feature to activate scenes in OpenHAB and Home Assistant is now available in the beta and soon to become stable, will close.