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

host platform: improvements and bugfixes #6137

Merged
merged 25 commits into from
Feb 7, 2024
Merged

Conversation

clydebarrow
Copy link
Contributor

@clydebarrow clydebarrow commented Jan 23, 2024

What does this implement/fix?

Tweaks to make the host: platform more usable.

The mac address was not being initialised on the host: platform, so would change randomly. This allows it to be configured, not perhaps as good as getting an actual one, but since there are likely to be multiple hardware interfaces, that's not really practical.

The sntp component just gets the current system time on host:

The text_sensor component had some incorrect C++ declaring virtual methods;

Replace sprintf with snprintf in helpers (NB there are still plenty of places in the codebase where this needs doing.)

Add timestamps to logger output (this is done by the logging program for non-host platforms.)

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Related issue or feature (if applicable): fixes

Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx
  • host

Example entry for config.yaml:

# Example config.yaml
host:
  mac_address: "62:23:45:AF:B3:DD"

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@probot-esphome
Copy link

Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (host) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@codecov-commenter
Copy link

codecov-commenter commented Jan 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9279875) 53.70% compared to head (0b8e577) 53.71%.
Report is 7 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #6137   +/-   ##
=======================================
  Coverage   53.70%   53.71%           
=======================================
  Files          50       50           
  Lines        9403     9404    +1     
  Branches     1653     1653           
=======================================
+ Hits         5050     5051    +1     
  Misses       4055     4055           
  Partials      298      298           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

fix text_sensor virtual methods;
replace sprintf with snprintf in helpers.
fix text_sensor filter declarations.
esphome/core/helpers.cpp Outdated Show resolved Hide resolved
esphome/core/helpers.cpp Outdated Show resolved Hide resolved
@nielsnl68
Copy link
Contributor

Clyde could you show me your YAML file where you use this and the VLC client. So i can us it myself as well?

@clydebarrow
Copy link
Contributor Author

clydebarrow commented Jan 29, 2024

Clyde could you show me your YAML file where you use this and the VLC client. So i can us it myself as well?

Sure. All the necessary stuff is merged into the lvgl branch. Sample host.yaml:

substitutions:
  name: host-lvgl
  friendly_name: Host lvgl test

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  name_add_mac_suffix: false
  project:
    name: esphome.host
    version: "1.1"

api:
  reboot_timeout: 0s

external_components:
  - source: github://clydebarrow/esphome@lvgl
    refresh: 10min
    components: [ lvgl, font, host, vnc, sntp, time]

packages:
  lvgl: !include lvgl-package.yaml

time:
  - platform: sntp
    id: esptime
    timezone: Australia/Sydney

logger:
  level: VERBOSE
  logs:
    lvgl: DEBUG
    display: DEBUG
    sensor: DEBUG
    vnc: DEBUG

host:
  mac_addr: "62:23:45:AF:B3:DD"

touchscreen:
  - platform: vnc
    id: vnc_touchscreen
    display: vnc_display

display:
  - platform: vnc
    id: vnc_display
    update_interval: never
    auto_clear_enabled: false
    dimensions:
      width: 450
      height: 600

lvgl:
  touchscreens:
    - touchscreen_id: vnc_touchscreen
      long_press_time: 800ms
      long_press_repeat_time: 400ms
  color_depth: 16
  byte_order: big_endian
  displays:
    - display_id: vnc_display

@probot-esphome
Copy link

Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (logger) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@clydebarrow clydebarrow changed the title host platform: configure mac address, use local time for sntp host platform: improvements and bugfixes Jan 31, 2024
@jesserockz jesserockz merged commit f3ef05f into esphome:dev Feb 7, 2024
101 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 9, 2024
@clydebarrow clydebarrow deleted the macaddr branch April 24, 2024 00:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants