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

Change variable "skip_updates" and "skip_updates_counter" type from "uint8_t" to "uint16_t" #4487

Merged
merged 5 commits into from
Feb 26, 2023

Conversation

GitforZhangXL
Copy link
Contributor

What does this implement/fix?

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

Example entry for config.yaml:

# Example config.yaml
esphome:
  name: meter-in

esp8266:
  board: esp01_1m

# Enable logging
logger:
  hardware_uart: UART1
# Enable Home Assistant API
api:
web_server:
  port: 80
ota:
  password: "123456789"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true
  ap:
    ssid: "Meter-In Fallback Hotspot"
    password: "123456789"

captive_portal:
uart:
  id: mod_uart
  tx_pin: 1
  rx_pin: 3
  baud_rate: 4800
  stop_bits: 1
modbus:
  send_wait_time: 200ms
  uart_id: mod_uart
  id: mod_bus
modbus_controller:
  - id: sdm
    address: 1
    modbus_id: mod_bus
    command_throttle: 50ms
    setup_priority: -10
    update_interval: 1s
    
sensor:
  - platform: modbus_controller
    modbus_controller_id: sdm
    device_class: "voltage"
    state_class: "measurement"
    id: input_voltage
    name: "Input voltage"
    address: 0x0048
    unit_of_measurement: "V" 
    register_type: holding
    value_type: U_DWORD
    register_count: 2
    accuracy_decimals: 1 
    filters:
      - multiply: 0.0001

  - platform: modbus_controller
    modbus_controller_id: sdm
    device_class: "current"
    state_class: "measurement"
    id: input_current
    name: "Input current"
    address: 0x0049
    unit_of_measurement: "A" 
    register_type: holding
    value_type: U_DWORD
    register_count: 2
    accuracy_decimals: 3 
    filters:
      - multiply: 0.0001

  - platform: modbus_controller
    modbus_controller_id: sdm
    device_class: "power"
    state_class: "measurement"
    id: total_active_power
    name: "Total active power"
    address: 0x004A
    unit_of_measurement: "W" 
    register_type: holding
    value_type: U_DWORD
    accuracy_decimals: 2 
    filters:
      - multiply: 0.0001      

  - platform: modbus_controller
    modbus_controller_id: sdm
    device_class: "energy"
    state_class: "total_increasing"
    id: total_active_energy
    name: "Total active energy"
    address: 0x004B
    unit_of_measurement: "kWh" 
    register_type: holding
    value_type: U_DWORD
    accuracy_decimals: 3 
    skip_updates: 600
    filters:
      - multiply: 0.0001      

  - platform: modbus_controller
    modbus_controller_id: sdm
    device_class: "power_factor"
    state_class: "measurement"
    id: total_active_power_factor
    name: "Total power_factor"
    address: 0x004C
    unit_of_measurement: "%" 
    register_type: holding
    value_type: U_DWORD
    accuracy_decimals: 2 
    filters:
      - multiply: 0.001   
  - platform: modbus_controller
    modbus_controller_id: sdm
    device_class: ""
    state_class: "measurement"
    id: total_active_frequency
    name: "Total frequency"
    address: 0x004F
    unit_of_measurement: "Hz" 
    register_type: holding
    value_type: U_DWORD
    accuracy_decimals: 2 
    filters:
      - multiply: 0.01  

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 @martgras, mind taking a look at this pull request as it has been labeled with an integration (modbus_controller) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

Copy link
Member

@jesserockz jesserockz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jesserockz jesserockz added this pull request to the merge queue Feb 26, 2023
Merged via the queue into esphome:dev with commit 86407b9 Feb 26, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 28, 2023
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.

3 participants