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

server-state-changed node always displays first entity in list #827

Closed
sym0nd0 opened this issue Jan 2, 2023 · 1 comment
Closed

server-state-changed node always displays first entity in list #827

sym0nd0 opened this issue Jan 2, 2023 · 1 comment

Comments

@sym0nd0
Copy link

sym0nd0 commented Jan 2, 2023

Describe the bug

For all of my server-state-changed nodes, when re-editing them the entity dropdown is displaying the wrong entity, it always shows the first available entity in the list. By all accounts, my flows work as expected but this issue is really frustrating, as I can't figure out how to resolve it.

I've tried restarting my instance, multiple times. Uninstalling, clearing out any left over folders and reinstalling Node-Red fresh. Even rebuilding flows from scratch. Yet this same issues keeps occurring and from search and posting on Reddit and the Home Assistant forum, it appears to only affect my setup.

To Reproduce

  1. Open the Node-Red UI
  2. Drag a server-state-changed node on to the workspace
  3. Double click server-state-changed node to edit it
  4. Take note of initial entry in Entity dropdown (is the first alpha entity option available)
  5. Change to the required entity
  6. Click Done
  7. Click Deploy
  8. Double click server-state-changed node to edit it
  9. Entity dropdown will be displaying the first alpha entity option again

Expected behavior

To retain the chosen/correct entity in the Entity dropdown

Screenshots

Fresh server-state-changed node:
3966f1a8b1dee06d63ca9f9b74da3c2ed51d9820

Changing just the entity to any other available and deploying:
9d1c75b905d4c804dc52965c6efdfad1037437fb

Re-editing the same node and the dropdown is back to the first in the list, although note the auto name of the node (highlighted):
62948b3faf28e5227f2f856e355a39302749a0f9

Example Flow

[
    {
        "id": "736d2248.bf409c",
        "type": "tab",
        "label": "Google Assistant",
        "disabled": false,
        "info": ""
    },
    {
        "id": "e12bf28.acca81",
        "type": "server-state-changed",
        "z": "736d2248.bf409c",
        "name": "Has media stopped playing?",
        "server": "65469739e72562c6",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "media_player.kitchen_display",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "off",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 140,
        "y": 100,
        "wires": [
            [
                "af890feb.3b614"
            ],
            []
        ]
    },
    {
        "id": "af890feb.3b614",
        "type": "api-call-service",
        "z": "736d2248.bf409c",
        "name": "Set volume to 4",
        "server": "65469739e72562c6",
        "version": 5,
        "debugenabled": false,
        "domain": "media_player",
        "service": "volume_set",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "media_player.kitchen_display"
        ],
        "data": "{\"volume_level\":\"0.4\"}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "data"
            }
        ],
        "queue": "none",
        "x": 360,
        "y": 100,
        "wires": [
            []
        ]
    },
    {
        "id": "e4ac108a.8b353",
        "type": "comment",
        "z": "736d2248.bf409c",
        "name": "Stop kitchen Google Hub from SCREAMING after playing Netflix",
        "info": "",
        "x": 250,
        "y": 40,
        "wires": []
    },
    {
        "id": "65469739e72562c6",
        "type": "server",
        "name": "Home Assistant",
        "version": 5,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": "at: ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "h23",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": true
    }
]

This package's version (not the Home Assistant add-on version)

0.48.0

Is Node-RED running in Docker?

Home Assistant add-on

Node-RED version

3.0.2

Node.js version

Unknown (sorry)

Additional context

Please let me know if you need any further info.

@hillbicks
Copy link

I can confirm this behavior. Do you experience slow opening of some nodes as well? See #839

How many entities do you have? I just did a select count(distinct entity_id) from states; and apparently I have over 3000 entity ids. I need to dig a bit deeper I guess.

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

No branches or pull requests

2 participants