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

KNX.send DTP 9.001 (temperature) conversion not ok #44792

Closed
SquaredCircleHunter opened this issue Jan 3, 2021 · 6 comments · Fixed by #44802 or XKNX/xknx#550
Closed

KNX.send DTP 9.001 (temperature) conversion not ok #44792

SquaredCircleHunter opened this issue Jan 3, 2021 · 6 comments · Fixed by #44802 or XKNX/xknx#550

Comments

@SquaredCircleHunter
Copy link

SquaredCircleHunter commented Jan 3, 2021

The problem

I want to update a temperature group object with a non integer value. The KNX.send service drops the fractional part when converting based on data type "temperature".

Environment

  • Home Assistant Core release with the issue: 2020.12.2
  • Last working Home Assistant Core release (if known):
  • Operating environment (OS/Container/Supervised/Core): Home Assistant OS 5.4.84
  • Integration causing this issue: KNX
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/knx

Problem-relevant configuration.yaml

Trigger:

  platform: event
      event_type: state_changed
      event_data:
        entity_id: input_number.vvw_setpoint_value_leefruimte

Action, doesnt work correctly -> drops fractional part:

    service: knx.send
    data_template:
      address: 5/1/1
      payload: "{{ trigger.event.data.new_state.state }}"
      type: temperature

Action, works correctly -> workaround crafted for my specific use case (ie. positive temperatures below 40,5°C where fractional part is 0 or 1/2):

    service: knx.send
    data_template:
      address: 5/1/1
      payload: ["{{ 8 + ( trigger.event.data.new_state.state|float * 50 )|int // 256 }}", "{{ ( trigger.event.data.new_state.state|float * 50 )|int % 256 }}"]

Traceback/Error logs

n/a

Additional information

@probot-home-assistant
Copy link

knx documentation
knx source
(message by IssueLinks)

@probot-home-assistant
Copy link

Hey there @Julius2342, @farmio, @marvin-w, mind taking a look at this issue as its been labeled with an integration (knx) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@farmio
Copy link
Contributor

farmio commented Jan 3, 2021

Have you tried casting the state to float in the template?

@SquaredCircleHunter
Copy link
Author

SquaredCircleHunter commented Jan 3, 2021

Hi,

That doesn't work neither:

  action:
    service: knx.send
    data_template:
      address: 5/1/9
      payload: "{{ trigger.event.data.new_state.state|float }}"
      type: temperature

In the ETS monitor I see 23 as incoming value

From the event trace:

{ "event_type": "call_service", "data": { "domain": "input_number", "service": "set_value", "service_data": { "value": 23.5, "entity_id": "input_number.vvw_setpoint_value_garage" } }, "origin": "LOCAL", "time_fired": "2021-01-03T17:27:25.242365+00:00", "context": { "id": "4586facb2fcfa334ddd3582230f503eb", "parent_id": null, "user_id": "fec541f9ca6b41e3b781ec769831d5ab" } }

{ "event_type": "call_service", "data": { "domain": "knx", "service": "send", "service_data": { "address": "5/1/9", "payload": 23.5, "type": "temperature" } }, "origin": "LOCAL", "time_fired": "2021-01-03T17:27:25.262404+00:00", "context": { "id": "60e5a9c22b3e69330391a7d2fb21d5ed", "parent_id": "4586facb2fcfa334ddd3582230f503eb", "user_id": null } }

farmio added a commit to farmio/home-assistant that referenced this issue Jan 3, 2021
@farmio farmio mentioned this issue Jan 3, 2021
21 tasks
@farmio
Copy link
Contributor

farmio commented Jan 3, 2021

Thanks! There was an error in our schema which coerced every value to int.

@SquaredCircleHunter
Copy link
Author

Thanks guys for the fast response!

@github-actions github-actions bot locked and limited conversation to collaborators Feb 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants