Command line sensor from P1/Han port help

HomeWizard Energy p1 meter works great and exactly as intended. But want the possibility to use command line to access the telegram between the meter, and p1 port to accsess more data then the intigration has. Entities for amp as an example.
.

This is what the telegram data shows.
http://10.x.x.xx/api/v1/telegram

No json here, ;( what to do ?

/AUX5U41SEH13F10024

0-0:96.1.0(38303034363937333432342748313031363723763032)
0-0:1.0.0(220901203330W)
1-0:1.8.0(000509.671*kWh)
1-0:2.8.0(000000.000*kWh)
1-0:3.8.0(000000.897*kvarh)
1-0:4.8.0(000222.363*kvarh)
1-0:1.7.0(0000.088*kW)
1-0:2.7.0(0000.000*kW)
1-0:3.7.0(0000.000*kvar)
1-0:4.7.0(0000.190*kvar)
1-0:21.7.0(0000.017*kW)
1-0:22.7.0(0000.000*kW)
1-0:41.7.0(0000.051*kW)
1-0:42.7.0(0000.000*kW)
1-0:61.7.0(0000.020*kW)
1-0:62.7.0(0000.000*kW)
1-0:23.7.0(0000.000*kvar)
1-0:24.7.0(0000.000*kvar)
1-0:43.7.0(0000.000*kvar)
1-0:44.7.0(0000.097*kvar)
1-0:63.7.0(0000.000*kvar)
1-0:64.7.0(0000.089*kvar)
1-0:32.7.0(233.9*V)
1-0:52.7.0(230.2*V)
1-0:72.7.0(234.1*V)
1-0:31.7.0(000.0*A)
1-0:51.7.0(000.6*A)
1-0:71.7.0(000.4*A)
!
sensor:
  - name: P1 Test
    platform: command_line
    command: 'curl -k --silent "http://10.x.x.xx/api/v1/telegram"'
    scan_interval: 10  

This dosent work. Max length is 255 characters as shown in the log.
Goal is to get every value in the telegram as a single entiti.

Try this:

1 Like

It worked perfectly, thank you very much for the quick reply and an easy solution :slight_smile:

I ended up with this :slight_smile:
Huge thanks @DCSBL

rest:
  - authentication: basic
    scan_interval: 5
    resource: http://10.0.1.11/api/v1/telegram
    sensor:
    - name: "Cumulative Active Import"
      unit_of_measurement: kWh
      state_class: "total_increasing"
      value_template: "{{ (value|regex_findall_index('1\\-0\\:1\\.8\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
      device_class: "energy"
    - name: "Cumulative Active Export"
      unit_of_measurement: kWh
      state_class: "total_increasing"
      value_template: "{{ (value|regex_findall_index('1\\-0\\:2\\.8\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
      device_class: "energy"
    - name: "Cumulative Reactive Import"
      unit_of_measurement: kvarh
      value_template: "{{ (value|regex_findall_index('1\\-0\\:3\\.8\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Cumulative Reactive Export"
      unit_of_measurement: kvarh
      value_template: "{{ (value|regex_findall_index('1\\-0\\:4\\.8\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Active Import"
      unit_of_measurement: kW
      value_template: "{{ (value|regex_findall_index('1\\-0\\:1\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Active Export"
      unit_of_measurement: kW
      value_template: "{{ (value|regex_findall_index('1\\-0\\:2\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Reactive Import"
      unit_of_measurement: kvar
      value_template: "{{ (value|regex_findall_index('1\\-0\\:3\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Reactive Export"
      unit_of_measurement: kvar
      value_template: "{{ (value|regex_findall_index('1\\-0\\:4\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Active Import Phase 1"
      unit_of_measurement: kW
      value_template: "{{ (value|regex_findall_index('1\\-0\\:21\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Active Export Phase 1"
      unit_of_measurement: kW
      value_template: "{{ (value|regex_findall_index('1\\-0\\:22\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Active Import Phase 2"
      unit_of_measurement: kW
      value_template: "{{ (value|regex_findall_index('1\\-0\\:41\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Active Export Phase 2"
      unit_of_measurement: kW
      value_template: "{{ (value|regex_findall_index('1\\-0\\:42\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Active Import Phase 3"
      unit_of_measurement: kW
      value_template: "{{ (value|regex_findall_index('1\\-0\\:61\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Active Export Phase 3"
      unit_of_measurement: kW
      value_template: "{{ (value|regex_findall_index('1\\-0\\:62\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Reactive Import Phase 1"
      unit_of_measurement: kvar
      value_template: "{{ (value|regex_findall_index('1\\-0\\:23\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Reactive Export Phase 1"
      unit_of_measurement: kvar
      value_template: "{{ (value|regex_findall_index('1\\-0\\:24\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Reactive Import Phase 2"
      unit_of_measurement: kvar
      value_template: "{{ (value|regex_findall_index('1\\-0\\:43\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Reactive Export Phase 2"
      unit_of_measurement: kvar
      value_template: "{{ (value|regex_findall_index('1\\-0\\:44\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Reactive Import Phase 3"
      unit_of_measurement: kvar
      value_template: "{{ (value|regex_findall_index('1\\-0\\:63\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Momentary Reactive Export Phase 3"
      unit_of_measurement: kvar
      value_template: "{{ (value|regex_findall_index('1\\-0\\:64\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Voltage Phase 1"
      unit_of_measurement: V
      value_template: "{{ (value|regex_findall_index('1\\-0\\:32\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Voltage Phase 2"
      unit_of_measurement: V
      value_template: "{{ (value|regex_findall_index('1\\-0\\:52\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Voltage Phase 3"
      unit_of_measurement: V
      value_template: "{{ (value|regex_findall_index('1\\-0\\:72\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Current Phase 1"
      unit_of_measurement: A
      value_template: "{{ (value|regex_findall_index('1\\-0\\:31\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Current Phase 2"
      unit_of_measurement: A
      value_template: "{{ (value|regex_findall_index('1\\-0\\:51\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
    - name: "Current Phase 3"
      unit_of_measurement: A
      value_template: "{{ (value|regex_findall_index('1\\-0\\:71\\.7\\.0\\([0-9.]*')).split('(',1)[-1].strip() }}"
1 Like