Selectronic SP-PRO select.live

We have successfully pulled the data available from a Selectronic SP-PRO inverter into HA using a rest sensor. There were 3 steps:

  1. get the local url for the Selectronic Inverter
  2. add a rest sensor to configuration.yaml
  3. add some sensor templates to configuration.yaml

1. local url: The Selectronic SP-PRO inverter controls an off-grid solar power installation. Selectronic (company) provides the free select.live website to monitor the power system. When you open the select.live dashboard in a browser you can typically right-click on the page and select view page source. Search for the variable live_URLs and make a copy of the first element in the array. The url will look something like:

//192.168.1.2/cgi-bin/solarmonweb/devices/732839EE3F53BDB735DFUYHD732793AB/point

If you paste this url into your browser address bar you will get to see the json reply from the Selectronic SP-PRO. Something like:

{
  "device":{
    "name":"Selectronic SP-PRO"
  },
  "item_count":22,
  "items":{
    "battery_in_wh_today":13.2890625,
    "battery_in_wh_total":126.615234375,
    "battery_out_wh_today":7.998046875,
    "battery_out_wh_total":117.87890625,
    "battery_soc":99.13671875,
    "battery_w":435.791015625,
    "fault_code":0,
    "fault_ts":0,
    "gen_status":0,
    "grid_in_wh_today":0.0,
    "grid_in_wh_total":0.56946533203125005,
    "grid_out_wh_today":0.0,
    "grid_out_wh_total":0.0,
    "grid_w":0.0,
    "load_w":389.1346435546875,
    "load_wh_today":7.1752631835937501,
    "load_wh_total":213.43560644531252,
    "shunt_w":0.0,
    "solar_wh_today":10.592055175781251,
    "solar_wh_total":233.02521386718752,
    "solarinverter_w":0.0,
    "timestamp":1594021705
  },
  "now":1594021710
}

2. rest sensor: Add the following lines to your configuration.yaml under the sensor: tag. Insert your local url as the resource:

sensor:
  - platform: rest
    name: "selectronic"
    json_attributes_path: "$.items"
    json_attributes:
      - 'battery_in_wh_today'
      - 'battery_in_wh_total'
      - 'battery_out_wh_today'
      - 'battery_out_wh_total'
      - 'battery_soc'
      - 'battery_w'
      - 'fault_code'
      - 'fault_ts'
      - 'gen_status'
      - 'grid_in_wh_today'
      - 'grid_in_wh_total'
      - 'grid_out_wh_today'
      - 'grid_out_wh_total'
      - 'grid_w'
      - 'load_w'
      - 'load_wh_today'
      - 'load_wh_total'
      - 'shunt_w'
      - 'solar_wh_today'
      - 'solar_wh_total'
      - 'solarinverter_w'
      - 'timestamp'
    resource: "http://192.168.1.2/cgi-bin/solarmonweb/devices/732839EE3F53BDB735DFUYHD732793AB/point"
    value_template: '{{ value_json.device.name }}'
    force_update: true
    

3. sensor templates: add some sensor templates to reformat the raw data a little. Some examples:

sensor:
  - platform: template

    sensors: # for data obtained from selectronic inverter

      power_battery_soc:
        friendly_name: battery soc
        device_class: battery
        value_template: "{{(state_attr('sensor.selectronic', 'battery_soc')|float) | round(1)}}"
        unit_of_measurement: "%"
        entity_id: sensor.selectronic
        
      power_battery_kw:
        friendly_name: battery load
        device_class: power
        value_template: "{{(-state_attr('sensor.selectronic', 'battery_w')|float /1000) | round(2)}}"
        unit_of_measurement: "kW"
        entity_id: sensor.selectronic
        
      power_load_kw:
        friendly_name: load
        device_class: power
        value_template: "{{(state_attr('sensor.selectronic', 'load_w')|float /1000) | round(1)}}"
        unit_of_measurement: "kW"
        entity_id: sensor.selectronic

      power_solar_kw:
        friendly_name: solar
        device_class: power
        value_template: "{{(state_attr('sensor.selectronic', 'solarinverter_w')|float /1000) | round(1)}}"
        unit_of_measurement: "kW"
        entity_id: sensor.selectronic
7 Likes

I realise that 2.5 years have passed, but I just wanted to add that this advice works well. I followed your steps and, apart from an unrelated firewall issue, everything ā€œjust workedā€. Thank you for working this out and posting this.

Overview_ā€“_Home_Assistant

1 Like

Weā€™ve recently installed a SPPro and Select.live unit but having looked at the source page in the Select.live portal I canā€™t see any URL that might give us access to the local Select.live device. Browsing to the ip for the local Select.live suggests itā€™s running a local webserver.

Any suggestions very welcome.

Cheers.

Another approach ā€¦ when I open:
http://192.168.1.2/cgi-bin/solarmonweb/devices/
I get:

[
  {
    "href":"/devices/732839EE3F53BDB736A26BDD732793AB",
    "id":"732839EE3F53BDB736A26BDD732793AB",
    "manufacturer":"Selectronic",
    "serialnum":XXXXXX",
    "short_id":"XXXXXX"
  }
]

and using this href I can build a url like:
http://192.168.1.9/cgi-bin/solarmonweb/devices/732839EE3F53BDB736A26BDD732793AB/point
and this delivers the json I use.

Hope this helps?

1 Like

Hi John,

Thanks for the info you have provided - super helpful!

Iā€™m having an issue where the Select.Live stops providing data daily at about 1:15am. It has an ā€˜authorisation requiredā€™ error and I awake to no data coming through until I wake up and reset it.

Are you having the same issue? Any ideas?

Cheers

I do not recall encountering an issue like this - but I wonder/guess:

  • maybe there is a time mismatch between HA and the selectronic? daylight saving?
  • maybe some other setting in the Selectronic that is upsetting things? relating to authority?
  • how do you go about resetting the selectronic?

I do recall some issue (long ago) where I had a problem at midnight when a device (maybe the Selectronic) spewed out a random negative value (maybe during a daily reset?) and I had to adjust my HA calcs to ignore negatives.

After trying this on my Home Assistant Green, I received this error in the notifications:

Checking the logs says: No issues found for search term ā€˜rest.sensorā€™. And if I were to load all logs, nothing would show.

What should I be putting into the configuration.yaml? I feel that there is an IP address specifically for Selectronic, instead of just for Select Live.

Here is my configuration.yaml:


# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

sensor:
  - platform: rest
    name: "selectronic"
    json_attributes_path: "$.items"
    json_attributes:
      - 'battery_in_wh_today'
      - 'battery_in_wh_total'
      - 'battery_out_wh_today'
      - 'battery_out_wh_total'
      - 'battery_soc'
      - 'battery_w'
      - 'fault_code'
      - 'fault_ts'
      - 'gen_status'
      - 'grid_in_wh_today'
      - 'grid_in_wh_total'
      - 'grid_out_wh_today'
      - 'grid_out_wh_total'
      - 'grid_w'
      - 'load_w'
      - 'load_wh_today'
      - 'load_wh_total'
      - 'shunt_w'
      - 'solar_wh_today'
      - 'solar_wh_total'
      - 'solarinverter_w'
      - 'timestamp'
    resource: "//192.168.1.4"
    value_template: '{{ value_json.device.name }}'
    force_update: true

template:
  sensor:
    # Data from selectronic for long term statistics
    - name: "battery use"
      device_class: energy
      state_class: total
      state: "{{(state_attr('sensor.selectronic', 'battery_out_wh_total')|float) | round(3)}}"
      unit_of_measurement: "kWh"
      unique_id: sensor.selectronic.batout
      
    - name: "battery charging"
      device_class: energy
      state_class: total
      state: "{{(state_attr('sensor.selectronic', 'battery_in_wh_total')|float) | round(3)}}"
      unit_of_measurement: "kWh"
      unique_id: sensor.selectronic.batin
        
    - name: "power use"
      device_class: energy
      state_class: total
      state: "{{(state_attr('sensor.selectronic', 'load_wh_total')|float) | round(3)}}"
      unit_of_measurement: "kWh"
      unique_id: sensor.selectronic.usage
        
    - name: "solar production"
      device_class: energy
      state_class: total
      state: "{{(state_attr('sensor.selectronic', 'solar_wh_total')|float) | round(3)}}"
      unit_of_measurement: "kWh"
      unique_id: sensor.selectronic.solar
      
    - name: "generator use total" # Use for "grid" stats in energy dashboard
      device_class: energy
      state_class: total
      state: "{{(state_attr('sensor.selectronic', 'grid_in_wh_total')|float) | round(3)}}"
      unit_of_measurement: "kWh"
      unique_id: sensor.selectronic.genTotal
1 Like

My scripts seem to have worked for the config file but no data is available.

Now once I reboot, I am getting errors.

2024-09-28 16:44:52.405 WARNING (MainThread) [homeassistant.helpers.translation] Failed to load integration for translation: Integration ā€˜resourceā€™ not found.

2024-09-28 16:44:52.410 WARNING (MainThread) [homeassistant.helpers.translation] Failed to load integration for translation: Integration ā€˜value_templateā€™ not found.

2024-09-28 16:44:52.413 WARNING (MainThread) [homeassistant.helpers.translation] Failed to load integration for translation: Integration ā€˜json_attributesā€™ not found.

2024-09-28 16:44:52.413 WARNING (MainThread) [homeassistant.helpers.translation] Failed to load integration for translation: Integration ā€˜nameā€™ not found.

2024-09-28 16:44:52.414 WARNING (MainThread) [homeassistant.helpers.translation] Failed to load integration for translation: Integration ā€˜force_updateā€™ not found.

2024-09-28 16:44:52.414 WARNING (MainThread) [homeassistant.helpers.translation] Failed to load integration for translation: Integration ā€˜json_attributes_pathā€™ not found.

2024-09-28 16:45:01.892 ERROR (MainThread) [homeassistant.config] Invalid config for ā€˜sensorā€™ from integration ā€˜restā€™ at configuration.yaml, line 13: must contain at least one of resource, resource_template. ā€˜ā€™, got {ā€˜platformā€™: ā€˜restā€™}, please check the docs at RESTful - Home Assistant

2024-09-28 16:45:02.992 ERROR (MainThread) [homeassistant.setup] Setup failed for ā€˜resourceā€™: Integration not found.

2024-09-28 16:45:02.996 ERROR (MainThread) [homeassistant.setup] Setup failed for ā€˜force_updateā€™: Integration not found.

2024-09-28 16:45:04.500 ERROR (MainThread) [homeassistant.setup] Setup failed for ā€˜value_templateā€™: Integration not found.

2024-09-28 16:45:04.546 ERROR (MainThread) [homeassistant.setup] Setup failed for ā€˜json_attributesā€™: Integration not found.

2024-09-28 16:45:04.552 ERROR (MainThread) [homeassistant.setup] Setup failed for ā€˜nameā€™: Integration not found.

2024-09-28 16:45:04.594 ERROR (MainThread) [homeassistant.setup] Setup failed for ā€˜json_attributes_pathā€™: Integration not found.

2024-09-28 16:45:20.333 WARNING (SyncWorker_4) [homeassistant.components.rpi_power.binary_sensor] Under-voltage was detected. Consider getting an uninterruptible power supply for your Raspberry Pi.

2024-09-28 16:45:24.446 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{(state_attr(ā€˜sensor.selectronicā€™, ā€˜battery_out_wh_totalā€™)|float) | round(3)}}) renders=2>

After messing around with the resource value, I have discovered the correct site that returns some JSON data:

https://192.168.1.4/cgi-bin/solarmonweb/devices/CE7DB5473D2274FBFE2974E9343FF711/point

{
  "device":{
    "name":"Selectronic SP-PRO"
  },
  "item_count":22,
  "items":{
    "battery_in_wh_today":15.50390625,
    "battery_in_wh_total":5362.259765625,
    "battery_out_wh_today":4.060546875,
    "battery_out_wh_total":4939.962890625,
    "battery_soc":99.0,
    "battery_w":-158.935546875,
    "fault_code":0,
    "fault_ts":0,
    "gen_status":0,
    "grid_in_wh_today":0.0,
    "grid_in_wh_total":42.596006835937501,
    "grid_out_wh_today":0.0,
    "grid_out_wh_total":0.0,
    "grid_w":0.0,
    "load_w":650.13958740234375,
    "load_wh_today":3.8723642578124999,
    "load_wh_total":7073.6705683593755,
    "shunt_w":0.0,
    "solar_wh_today":10.592055175781251,
    "solar_wh_total":8979.6710346679683,
    "solarinverter_w":873.18017578125,
    "timestamp":1727578429
  },
  "now":1727578435
}

I restarted, and saw this:

The data was still unavailable, so I tried to remove the https:// and got the same result. I have no idea why this is happening. Hereā€™s my new configuration.yaml:


# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

sensor:
  - platform: rest
    name: "Selectronic SP-PRO"
    json_attributes_path: "$.items"
    json_attributes:
      - 'battery_in_wh_today'
      - 'battery_in_wh_total'
      - 'battery_out_wh_today'
      - 'battery_out_wh_total'
      - 'battery_soc'
      - 'battery_w'
      - 'fault_code'
      - 'fault_ts'
      - 'gen_status'
      - 'grid_in_wh_today'
      - 'grid_in_wh_total'
      - 'grid_out_wh_today'
      - 'grid_out_wh_total'
      - 'grid_w'
      - 'load_w'
      - 'load_wh_today'
      - 'load_wh_total'
      - 'shunt_w'
      - 'solar_wh_today'
      - 'solar_wh_total'
      - 'solarinverter_w'
      - 'timestamp'
    resource: "192.168.1.4/cgi-bin/solarmonweb/devices/CE7DB5473D2274FBFE2974E9343FF711/point"
    value_template: '{{ value_json.device.name }}'
    force_update: true

template:
  sensor:
    # Data from selectronic for long term statistics
    - name: "battery use"
      device_class: energy
      state_class: total
      state: "{{(state_attr('sensor.selectronic', 'battery_out_wh_total')|float) | round(3)}}"
      unit_of_measurement: "kWh"
      unique_id: sensor.selectronic.batout
      
    - name: "battery charging"
      device_class: energy
      state_class: total
      state: "{{(state_attr('sensor.selectronic', 'battery_in_wh_total')|float) | round(3)}}"
      unit_of_measurement: "kWh"
      unique_id: sensor.selectronic.batin
        
    - name: "power use"
      device_class: energy
      state_class: total
      state: "{{(state_attr('sensor.selectronic', 'load_wh_total')|float) | round(3)}}"
      unit_of_measurement: "kWh"
      unique_id: sensor.selectronic.usage
        
    - name: "solar production"
      device_class: energy
      state_class: total
      state: "{{(state_attr('sensor.selectronic', 'solar_wh_total')|float) | round(3)}}"
      unit_of_measurement: "kWh"
      unique_id: sensor.selectronic.solar
      
    - name: "generator use total" # Use for "grid" stats in energy dashboard
      device_class: energy
      state_class: total
      state: "{{(state_attr('sensor.selectronic', 'grid_in_wh_total')|float) | round(3)}}"
      unit_of_measurement: "kWh"
      unique_id: sensor.selectronic.genTotal

Hi @matluma - there are a couple of items in your logs that I would be investigating further:

2024-09-28 16:45:01.892 ERROR (MainThread) [homeassistant.config] Invalid config for ā€˜sensorā€™ from integration ā€˜restā€™ at configuration.yaml, line 13: must contain at least one of resource, resource_template. ā€˜ā€™, got {ā€˜platformā€™: ā€˜restā€™}, please check the docs at RESTful - Home Assistant

I suspect maybe that you have a syntax error or some other silly in your config. I would be having a careful look at line 13 and at the ā€œresource:ā€ setting in particular. it should look something like

resource: "http://192.168.1.2/cgi-bin/solarmonweb/devices/732839EE3F53BDB735DFUYHD732793AB/point"

2024-09-28 16:45:20.333 WARNING (SyncWorker_4) [homeassistant.components.rpi_power.binary_sensor] Under-voltage was detected. Consider getting an uninterruptible power supply for your Raspberry Pi.

I am guessing that you are using a non-official power supply for your RPi - and these little devices do some really weird random stuff when they are not getting the power they need. I would be getting a official RPi power supply - other wise you will often be chasing really weird errors - and you will feel sad

I think you are definitely on the right track with

You seem to be getting sensible json data from that address - good.

I have seen HA spit out ā€œUnavailableā€ for some devices on my network from time to time - but they come good after a while - so maybe just a little patience will solve the problem?

I also wonder if there is something else going on with your network setup?

  • Have you assigned a static IP address for your Selectronic on your router? That is - is the Selectronic always at 192.168.1.4? Does the address above always return the json data? Or has the address changed? Be sure to assign a static address (in your router) for your Selectronic.
  • Has your Selectronic have access to a strong WiFi signal? or is it marginal? A marginal WiFi signal on the Selectronic may cause issues like this

That is all I can think of for the moment - hope it helps?

I donā€™t think either of those was the problem as the signal seems pretty good (63%) and it does have a static IP address from what I can see. 63% does seem pretty good - and I donā€™t think I can get it any better. Should the URL in the configuration.yaml have the https:// at the start?