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

Number component doesn't work properly in HA #10

Open
timota opened this issue Jun 12, 2023 · 2 comments
Open

Number component doesn't work properly in HA #10

timota opened this issue Jun 12, 2023 · 2 comments

Comments

@timota
Copy link

timota commented Jun 12, 2023

Number component doesn't work properly in HA.
Due to scale up/down feature, number in gui more or less from original number provided by canopen node.

Example:

CO Node:

sprinkler: 
        ...
       # number component
        run_duration_number:
          id: ctrlr_z2_run_duration_number
          name: 'Zone#2 Duration'
          unit_of_measurement: min
          restore_value: true
          initial_value: 1
          max_value: 30
          mode: box

   # co configuration
   ...
    - id: ctrlr_z2_run_duration_number
      index: 6
      tpdo: 2
      size: 1
      min_value: 1
      max_value: 30
      rpdo:
        - node_id: ${can_client_id}
          tpdo: 2
          offset: 1

when number set to 6 on node, it appears as 5 in GUI, 30->29
I guess this is something with rounding numbers.

Also, according to documentation, (https://www.home-assistant.io/integrations/number.mqtt/) autodiscovery mqtt message should should be presented as min and max (currenly min_value, and max_value ) to make it work properly in GUI

{
"object_id": "can_00b_06", 
"entity_id": "can_00b_06", 
"unique_id": "can_00b_06", 
"availability": [
    {
       "topic": "homeassistant/can_00b/availability"
    }, 
    {
      "topic": "homeassistant/can2mqtt/status"
    }
], 
"availability_mode": "all",
"device": {
    "identifiers": ["canopen_node_11"], 
    "name": "can-slave-3", 
    "sw_version": "", 
    "hw_version": "", 
    "manufacturer": "mrk", 
    "model": "esphome-canopen"
}, 
"name": "Zone#2 Duration", 
"min_value": 1.0, 
"max_value": 30.0, 
"command_topic": "homeassistant/can_cmd_00b_20620100", 
"state_topic": "homeassistant/can_state_00b_20610100"
}
@mrk-its
Copy link
Owner

mrk-its commented Jun 12, 2023

Ok, will try to reproduce it.

In the meantime try to remove min_value & max_value from co configuration (for single byte it will default to 0-255)

@timota
Copy link
Author

timota commented Jun 12, 2023

will try, but if you can add min/max to autodiscovery - it will fix part of issue with gui. Values wont overflow as default (1/100)

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