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

Status translate #2

Open
Marcepanfazik opened this issue Oct 20, 2024 · 0 comments
Open

Status translate #2

Marcepanfazik opened this issue Oct 20, 2024 · 0 comments

Comments

@Marcepanfazik
Copy link


uart:
  - id: mod_bus1
    tx_pin: 16
    rx_pin: 17
    baud_rate: 9600
    stop_bits: 1

modbus:
  - uart_id: mod_bus1
    send_wait_time: 200ms
    id: mod_bus_1

modbus_controller:
  - id: mppt
    address: 0x1
    modbus_id: mod_bus_1
    command_throttle: 200ms
    setup_priority: -10
    update_interval: 5s

time:
  - platform: sntp
    id: my_time

captive_portal:

button:
  - platform: restart
    name: "Restart"

text_sensor:
  - platform: wifi_info
    ip_address:
      name: IP Address
    ssid:
      name: Connected SSID
    scan_results:
      name: Scan Results
  - platform: template
    name: MPPT Status
    id: txt_mppt
  - platform: template
    name: Charger Workstate
    id: txt_chg
  - platform: template
    name: Charging Mode
    id: txt_md 

sensor:
  - platform: modbus_controller
    modbus_controller_id: mppt
    name: Charger Workstate
    address: 15201
    register_type: holding
    value_type: U_WORD
    register_count: 1
    internal: true
    id: chg_wrk
    on_value: 
      then:
        - if:
            condition:
              - lambda: |-
                  return id(chg_wrk).state == 0;
            then:
              - text_sensor.template.publish:
                  id: txt_chg
                  state: "Initialization"
        - if:
            condition:
              - lambda: |-
                  return id(chg_wrk).state == 1;
            then:
              - text_sensor.template.publish:
                  id: txt_chg
                  state: "Self Test"            
        - if:
            condition:
              - lambda: |-
                  return id(chg_wrk).state == 2;
            then:
              - text_sensor.template.publish:
                  id: txt_chg
                  state: "Working"
        - if:
            condition:
              - lambda: |-
                  return id(chg_wrk).state == 3;
            then:
              - text_sensor.template.publish:
                  id: txt_chg
                  state: "OFF"

  - platform: modbus_controller
    modbus_controller_id: mppt
    name: MPPT state
    address: 15202
    register_type: holding
    value_type: U_WORD
    register_count: 1
    id: mppt_st
    internal: true
    on_value: 
      then:
        - if:
            condition:
              - lambda: |-
                  return id(mppt_st).state == 0;
            then:
              - text_sensor.template.publish:
                  id: txt_mppt
                  state: "Stop"
        - if:
            condition:
              - lambda: |-
                  return id(mppt_st).state == 1;
            then:
              - text_sensor.template.publish:
                  id: txt_mppt
                  state: "MPPT"            
        - if:
            condition:
              - lambda: |-
                  return id(mppt_st).state == 2;
            then:
              - text_sensor.template.publish:
                  id: txt_mppt
                  state: "Current limiting"

  - platform: modbus_controller
    modbus_controller_id: mppt
    name: Charging state
    address: 15203
    register_type: holding
    value_type: U_WORD
    register_count: 1
    id: chg_sts
    internal: true
    on_value: 
      then:
        - if:
            condition:
              - lambda: |-
                  return id(chg_sts).state == 0;
            then:
              - text_sensor.template.publish:
                  id: txt_md
                  state: "Stop"
        - if:
            condition:
              - lambda: |-
                  return id(chg_sts).state == 1;
            then:
              - text_sensor.template.publish:
                  id: txt_md
                  state: "Boost charging"            
        - if:
            condition:
              - lambda: |-
                  return id(chg_sts).state == 2;
            then:
              - text_sensor.template.publish:
                  id: txt_md
                  state: "Float charging"
        - if:
            condition:
              - lambda: |-
                  return id(chg_sts).state == 3;
            then:
              - text_sensor.template.publish:
                  id: txt_md
                  state: "Equalization"

  - platform: modbus_controller
    modbus_controller_id: mppt
    id: pv_input_voltage
    name: PV voltage
    address: 15205
    unit_of_measurement: "V" ## for any other unit the value is returned in minutes
    register_type: holding
    value_type: U_WORD
    register_count: 1
    accuracy_decimals: 1
    icon: mdi:sine-wave
    filters:
      - multiply: 0.1  
  
  - platform: modbus_controller
    modbus_controller_id: mppt
    id: batt_input_voltage
    name: Battery voltage
    address: 15206
    unit_of_measurement: "V" ## for any other unit the value is returned in minutes
    register_type: holding
    value_type: U_WORD
    register_count: 1
    accuracy_decimals: 1
    icon: mdi:sine-wave
    filters:
      - multiply: 0.1  

  - platform: modbus_controller
    modbus_controller_id: mppt
    id: batt_input_current
    name: Battery current
    address: 15207
    unit_of_measurement: "A" 
    register_type: holding
    value_type: U_WORD
    register_count: 1
    filters:
      - multiply: 0.1
    accuracy_decimals: 1

  - platform: modbus_controller
    modbus_controller_id: mppt
    id: pv_input_power
    name: PV power
    address: 15208
    unit_of_measurement: "W" ## for any other unit the value is returned in minutes
    register_type: holding
    value_type: U_WORD
    register_count: 1
    accuracy_decimals: 1
    icon: mdi:sine-wave

  - platform: modbus_controller
    modbus_controller_id: mppt
    name: MPPT temperature
    address: 15209
    unit_of_measurement: "°C" ## for any other unit the value is returned in minutes
    register_type: holding
    value_type: U_WORD
    register_count: 1

  - platform: modbus_controller
    modbus_controller_id: mppt
    name: Battery temperature
    address: 15210
    unit_of_measurement: "°C" ## for any other unit the value is returned in minutes
    register_type: holding
    value_type: U_WORD
    register_count: 1
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

1 participant