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

publish_state excepts float #7

Open
dansity opened this issue Mar 28, 2023 · 3 comments
Open

publish_state excepts float #7

dansity opened this issue Mar 28, 2023 · 3 comments

Comments

@dansity
Copy link

dansity commented Mar 28, 2023

Hi,

When trying to flash it the Beaufort wind scale produces error as publish_state excepts float instead of char. It might be something that has changed with updates over time.

/config/esphome/weatherstation.yaml: In lambda function:
/config/esphome/weatherstation.yaml:77:40: error: cannot convert 'const char [2]' to 'float'
   77 |           id(wind_scale_code).publish_state("0");
      |                                        ^~~
      |                                        |
      |                                        const char [2]
In file included from src/esphome/core/controller.h:17,
                 from src/esphome/components/api/api_server.h:4,
                 from src/esphome/components/api/api_connection.h:6,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
src/esphome/components/sensor/sensor.h:126:28: note:   initializing argument 1 of 'void esphome::sensor::Sensor::publish_state(float)'
  126 |   void publish_state(float state);
      |                      ~~~~~~^~~~~

github messed up the indentation, attached a screenshot for clarity
2023-03-28 16_32_08-ESPHome – Home Assistant — Mozilla Firefox

@hugokernel
Copy link
Owner

Use ``` and not ` for multiline block.

About the problem, I will look at that when I have some time.

@hugokernel
Copy link
Owner

Is this still relevant?
Have you updated ESPHome?

@dansity
Copy link
Author

dansity commented Mar 4, 2024

Hi, for me it is not relevant in the sense that I removed the Beaufort scale and been using the rest of the script happily. So I'm not sure if it compiles with new ESPhome versions. If it does feel free to close the issue.

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