Closed iMicknl closed 1 month ago
@jamesmyatt did you face similar issues on the latest version? I will look into this as well, but not sure if I am doing anything wrong here.
Including #include <cstdint>
and changing byte
to std::uint8_t
seems to fix the issue. Haven't tested it on device yet.
Works for me with the ESPHome 2024.5.5 addon. Here's my config exactly (except for the device name): https://gist.github.com/jamesmyatt/570aa3e886ca748c23d572bfb324d90e.
Although the height sensor only updates when using the cover and number entities, but that seems like a separate issue.
@jamesmyatt interesting, for me in 2024.5.5 this doesn't work. Both locally in a just created devcontainer as on my HA Core OS. Both run Python 3.12 and esphome==2024.5.5.
Before the change to custom component, did the sensor updates work? Or did you face the same issue?
I think the sensor updates was the same before. I need to fire up my logic analyser to see what's going on with the serial interface.
I'll also take try compiling in a ESPHome dev container later, but I've been using the official ESPHome add-on with HA OS x86 VM.
@jamesmyatt can you perhaps try my latest changes in branch 2.3 when you have time?
I added some CI/CD to spot these issues more easily, and it fails on the same error on CI as on my local machine. See https://github.com/iMicknl/LoctekMotion_IoT/actions/runs/9428679879/job/25974279658
Also compiles fine for me using the esphome/esphome:2024.5.5
image as a devcontainer, for both v2 and v2.3 branches.
I think this is the associated dockerfile: https://github.com/esphome/esphome/blob/dev/docker/Dockerfile. It uses Python 3.11.2 rather than 3.12.
@jamesmyatt I am really lost on why this wouldn't compile for me, while it does for you. Have you tried v2.3?
Which YAML file are you using?
That fails for me in the ESPHome addon. Let me dig a little more.
OK. Your config works for me when I add an MQTT component. This must be including some extra headers that are defining byte
etc.
# Enable MQTT
mqtt:
broker: !secret mqtt_broker
port: !secret mqtt_port
username: !secret mqtt_username
password: !secret mqtt_password
discovery: false
topic_prefix: "esphome/${device_name}"
@jamesmyatt best thing would be to change the definition in the files. Would you mind testing https://github.com/iMicknl/LoctekMotion_IoT/tree/v2.3 or https://github.com/iMicknl/LoctekMotion_IoT/tree/2.4? Both have a different implementation. 2.4 is cleaner in my opinion and seems to work well for my desk.
I think the right type here is uint8_t
like here: https://github.com/esphome/esphome/blob/2fc43fa9c71e7f1a5785efffee787033366ca188/esphome/components/uart/uart.h#L29
In fact, it looks like it's more correct to use the read_byte
method, rather than the read
one to get the bytes.
PR is here: #89 . #88 needs merging first.
Thanks @jamesmyatt! By the way, are you on Discord as well? Happy to add you as contributor on this repo, if you want to.