home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.72k stars 29.98k forks source link

MQTT fan speed_state_status topic only accepts low, medium or high regardless of configured fan speeds #45234

Closed jbouwh closed 3 years ago

jbouwh commented 3 years ago

The problem

When using MQTT auto discovery for MQTT fan I want to use the speed_status_topic to report back de actual state. Speeds are configured using spds but only the speeds 'low', 'medium' and 'high' are accepted when this status is updated over MQTT using the speed_state_topic (spd_stat_t).

Example config topic:

{
  "~": "homeassistant/fan/F4CFA2E52D00_1",
  "uniq_id": "F4CFA2E52D00_1",
  "name": "Ventilator",
  "stat_t": "~/state",
  "cmd_t": "~/set",
  "spd_stat_t": "~/spdst",
  "spds": [
    "low",
    "2",
    "3",
    "4",
    "medium",
    "high"
  ],
  "spd_cmd_t": "~/spd",
  "dev": {
    "identifiers": [
      "F4CFA2E52D00_1"
    ],
    "mf": "JBSoft",
    "mdl": "Remote fan controller",
    "name": "Ventilator",
    "sw": "JBFanOnESP 1.0"
  }
}

When reporting back the speedstate over topic ~/spdst, only setting the values low, medium and high have effect. All configured speeds are loaded in the gui.

The fan speed configured should be used to be able to update the state and not the states that predefined (low, medium, high).

Environment

System Health

version 2021.1.3
installation_type Home Assistant OS
dev false
hassio true
docker true
virtualenv false
python_version 3.8.7
os_name Linux
os_version 5.4.79-v7l
arch armv7l
timezone Europe/Amsterdam
Home Assistant Community Store GitHub API | ok -- | -- Github API Calls Remaining | 4978 Installed Version | 1.10.0 Stage | running Available Repositories | 771 Installed Repositories | 3
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Hass.io host_os | Home Assistant OS 5.10 -- | -- update_channel | stable supervisor_version | 2021.01.4 docker_version | 19.03.13 disk_total | 57.6 GB disk_used | 7.6 GB healthy | true supported | true board | rpi4 supervisor_api | ok version_api | ok installed_addons | Terminal & SSH (8.10.0), AppDaemon 4 (0.3.2), Check Home Assistant configuration (3.6.0), File editor (5.2.0), Mosquitto broker (5.1), Portainer (1.3.0), Grafana (5.3.6), InfluxDB (3.7.9)
Lovelace dashboards | 1 -- | -- mode | storage views | 5 resources | 0

Problem-relevant configuration.yaml

mqtt:
  broker: 127.0.0.1
  discovery: true
  discovery_prefix: homeassistant

Traceback/Error logs

No errors appear in the log

Additional information

n/a

probot-home-assistant[bot] commented 3 years ago

mqtt documentation mqtt source (message by IssueLinks)

probot-home-assistant[bot] commented 3 years ago

Hey there @home-assistant/core, @emontnemery, mind taking a look at this issue as its been labeled with an integration (mqtt) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

frenck commented 3 years ago

This actually correct behavior and expected.

Home Assistant supports the following fan speeds:

The Fan entity model does not support or allow any other speeds. This is by design.

https://developers.home-assistant.io/docs/core/entity/fan

There is an architectural discussion on adding/allowing more fan speed open here:

https://github.com/home-assistant/architecture/issues/127

jbouwh commented 3 years ago

Then why do all adverized speeds show in the speed list? Integrity is missing here! It is possible to override the default speedlist, this is also by design!