Creating Enigma2 Sensors with Scrape Sensor

I needed to know the state of my Gigablue Enigma 2 set-top satellite box. Was working on pythons scripts when it suddenly dawned on me I could use the Scrape senor with the Enigma2 web API

This requires the Openwebif interface to be installed on the enigma2 box. This is default on most distro’s. You will need to change the IP address to your box details

The following sensor shows the current channel

 - platform: scrape
    resource: http://192.168.1.91/web/subservices
    name: TV Channel 
    select: 'e2servicename'

The current TV program

- platform: scrape
    resource: http://192.168.1.91/web/getcurrent
    name: TV Program 
    select: 'e2eventtitle'

If the box is on or in standby

- platform: scrape
    resource: http://192.168.1.91/web/powerstate 
    name: Gigablue Power State
    select: 'e2instandby'
    value_template: '{{value.replace("true","off")|replace("false","on") }}'

You can scrape almost any data from the web interface very simply. Much easier than coding. I hope this idea helps others

4 Likes

Hi,

FYI I just shared my Enigma2 media_player custom_component at Beyonwiz T4 (potentially Enigma2 STB) media player custom component

Also I’ve been doing something similar to you for a status panel card.

  - platform: rest
    name: beyonwiz_station
    resource: 'http://192.168.1.29/api/statusinfo'
    headers:
      content-type: application/json
      user-agent: home-assistant/rest-sensor
    value_template: >-
      {% if value_json.currservice_station %} 
        {{ value_json.currservice_station }}
      {%- else -%}
        N/A
      {% endif %}
    scan_interval: 5

  - platform: rest
    name: beyonwiz_program
    resource: 'http://192.168.1.29/api/statusinfo'
    headers:
      content-type: application/json
      user-agent: home-assistant/rest-sensor
    value_template: '{{ value_json.currservice_name }}'
    scan_interval: 5

  - platform: rest
    name: beyonwiz_begin_end
    resource: 'http://192.168.1.29/api/statusinfo'
    headers:
      content-type: application/json
      user-agent: home-assistant/rest-sensor
    value_template: >-
      {{ value_json.currservice_begin }} - {{ value_json.currservice_end }} 
    scan_interval: 5

  - platform: rest
    name: beyonwiz_muted
    resource: 'http://192.168.1.29/api/statusinfo'
    headers:
      content-type: application/json
      user-agent: home-assistant/rest-sensor
    value_template: '{{ value_json.muted }}'
    scan_interval: 5
  
  - platform: rest
    name: beyonwiz_volume
    resource: 'http://192.168.1.29/api/statusinfo'
    headers:
      content-type: application/json
      user-agent: home-assistant/rest-sensor
    value_template: '{{ value_json.volume }}'
    scan_interval: 5

  - platform: rest
    name: beyonwiz_recording
    resource: 'http://192.168.1.29/api/statusinfo'
    headers:
      content-type: application/json
      user-agent: home-assistant/rest-sensor
    value_template: >-
      {% if value_json.isRecording %} 
        {{ value_json.Recording_list }}
      {%- else -%}
        N/A
      {% endif %}
    scan_interval: 5

image

Not the prettiest but it served its purpose.

Thanks for heads up. I will certainly checkout your Enigma component.