marq24 / ha-tibber-pulse-local

Local/LAN Tibber Pulse IR/Bridge Integration for Home Assistant. My Tibber invitation Link: https://invite.tibber.com/6o0kqvzf (Code: six, oscar, zero, kilo, quebec, victor, zulu, foxtrot)
Apache License 2.0
112 stars 4 forks source link
hacs hacs-integration home-assistant home-assistant-hacs home-assistant-integration tibber tibberpulse

Tibber Pulse IR LOCAL

If you like to access the data of your Tibber Pulse IR directly (instead via the detour through the cloud), then there is a simple approach to read the data directly from the Tibber Pulse Bridge. There are alternative solutions via an additional MQTT - but why should the data go through such a proxy, if it can be read directly.

This integration will work only with the IR Version of the Tibber Pulse. There are other versions: P1, HAN or KM (sold in countries like Sweden, Norway or Netherlands) that are not compatible with this integration. If you are not sure, what Tibber Pulse version you have just check, if you have an additional 'Bridge' device - which is basically an additional thing, that you have to plug into a power outlet (see the picture below).

Please note, that this integration is not official and not supported by the tibber development team. I am not affiliated with tibber in any way.

hacs_badge github BuyMeCoffee PayPal hainstall


Tibber Invitation link

Advertisement / Werbung

If you want to join Tibber (become a customer), you might want to use my personal invitation link. When you use this link, Tibber will we grant you and me a bonus of 50,-€ for each of us. This bonus then can be used in the Tibber store (not for your power bill) - e.g. to buy a Tibber Bridge. I am fully aware, that when you are here in this repository the chances are very high, that you are already a Tibber customer and have already a Tibber Pulse. If you are already a Tibber customer and have not used an invitation link yet, you can also enter one afterward in the Tibber App (up to 14 days). [see official Tibber support article]

Please consider using my personal Tibber invitation link to join Tibber today or Enter the following code: 6o0kqvzf (six, oscar, zero, kilo, quebec, victor, zulu, foxtrot) afterward in the Tibber App - TIA!


Know Issues

Want to report an issue?

Please use the GitHub Issues for reporting any issues you encounter with this integration. Please be so kind before creating a new issues, check the closed ones, if your problem have been already reported (& solved).

In order to speed up the support process you might like already prepare and provide DEBUG log output. In the case of a technical issue - like not-supported--yet-communication-mode - I would need this DEBUG log output to be able to help/fix the issue. There is a short tutorial/guide 'How to provide DEBUG log' here - please take the time to quickly go through it.

Kudos

Preparation: Enabling the web frontend of the Tibber Pulse Bridge [Required]

To enable the web frontend permanently, one local variable needs to be set in the web frontend. But to get into the web frontend for the first time you need to start the Tibber Pulse Bridge in AccessPoint mode. This can be done by the following steps:

1. Start AP-Mode

The LED on the Tibber bridge should now light up green and not light blue anymore.

If this is not the case, then try this alternative:

NOW the LED on the Tibber bridge should now light up green and not light blue anymore.

2. Connect to the Pulse Bridge WiFi AccessPoint

Now use any device (laptop, tablet, phone) to connect to the Tibber Bridge WiFi network. The password for the WiFi is the nine characters printed on the Tibber bridge - it's important to include the dash. The password should have the pattern like this example one: AD56-54BA.

img|160x90

3. Set webserver_force_enable to true in the web frontend

After you are connected to the WiFi that have been created by the Pulse Bridge with your laptop/phone, use a web browser on that device to connect to http://10.133.70.1/. You will be prompted for a user and a password (BasicAuth).

The username is admin and the password is again the nine characters printed on the Tibber bridge.

Depending on the hardware revision and firmware there are two alternatives to archive this goal. Please select the procedure that fit your situation.

Via CONSOLE-Tab

With a recent firmware release the webserver_force_enable flag (39) does not appear any longer in the param list. So the console tab is the way to go!

  1. Go to http://10.133.70.1/console/

  2. type param_get 39 (just to ensure, that the system still know the webserver_force_enable parameter) - you can also try to type param_get webserver_force_enable [and press the send button afterwards] - this should give you some output like this:

    tibber-bridge> param_get 39
    esp32> param_get 39
    webserver_force_enable (39):
    false
    Command 'param_get 39' executed successfully
  3. So if 39 (= webserver_force_enable) is still present, then and only then you can continue!

  4. type param_set 39 TRUE (the upper case of TRUE is important here) [and press the send button afterward]

  5. type param_store [and press the send button afterward]

  6. for confirmation, you can type again param_get 39 [and press the send button afterward]

Via PARAMS-Tab [previously the default procedure]

  1. Go to http://10.133.70.1/params/
  2. Find the variable webserver_force_enable in the list
  3. Set the value to true (lower case)
  4. Press "Store params to flash" on the bottom of the page.

Please do not modify any other values in the params list!

4. Bring your Pulse & Bridge back to normal operation

Unplug the Tibber bridge, wait ten seconds and plug it back again. Now it should connect back to your previously configured WiFi and should work as before (submit the data to Tibber) - the LED should light up light blue again.

5. Final testing [do not continue if you did not complete this final step]

Part I: Access the web frontent

After you have successfully reset the Tibber bridge (AP mode is OFF and you are back in normal operation mode). Since you have set the webserver_force_enable to true the web frontend should now be still accessible via the following URL: http://tibber-host/ or http://tibber-bridge/.

If the hostname 'tibber-host' (or 'tibber-bridge') is not going to work for you in your LAN, you might like to check the IP-Address of your Tibber Pulse Bridge in your Router. The IP is not the 10.133.70.1 any longer!

Personally I have configured my router in a way, that the Pulse Bridge gets allways the same IP assigned. I just can recommend to do the same. Since accessing the device via IP (instead of the host name) will save you DNS-Lookups.

When you open the web frontend of the bridge, you always have to provide the user admin and the password.

img|160x90

Now (when the frontend works for you) almost everything is prepared... Just one more thing to check:

Part II: Ensure that there is at least one node paired with the bridge

For what ever reasons there are experts out there, trying to use this integration without having paired the Tibber Pulse reading head (the part is mounted at your power meter) with the Tibber Pulse Bridge. For sure this not going to work! The pairing procedure is part of the regular Tibber Pulse setup process with your Tibber app - so probably you have done this already - but just in case:

Please double-check by opening the http://[YOUR_IP]/nodes/ section (you can select from the menu the 'NODES' entry) and ensure, that there is at least one node listed - which means that the bridge is connected with the reading-head-unit.

Here you can also check, if the node is listed with the (expected) default NodeId value 1. If you have a different NodeId, then you need to adjust the expert setting Node Number (expert setting) when configure this integration.

Part III: Check 'Last seen' & 'Last data' [update frequency]

  1. Go to http://[YOUR-IP]/nodes/ (just like in part II)
  2. Take a look at the value Last data

    This last data value is the last time (in seconds) the bridge have received a data update from the reading head. This value should not be higher than 2.5-5seconds.

    If your Last data is frequently recently greater than this, then this integration can't work in a reliable way.

    Rotate the reading head few degrees anti-clock wise in order to check, if the update frequency will be better (smaller).

    img|20x20

    Please also have a look at the post from @ckarrie in order to learn a difference even few degrees can make!

Finally, you are done!

When part I, II & III are completed/confirmed, then you can install and use this Tibber Local Polling integration.

Setup / Installation

Step I: Install the integration

Option 1: via HACS

Option 2: manual steps

Step II: Adding or enabling the integration

You must have installed the integration (manually or via HACS before)!

Option 1: My Home Assistant (2021.3+)

Just click the following Button to start the configuration automatically (for the rest see Option 2: Manually steps by step):

Open your Home Assistant instance and start setting up a new integration.

Option 2: Manually steps by step

Add custom integration using the web interface and follow instruction on screen.

IMPORTANT to know: During the setup of this integration it will be checked, if there is at least one OBIS-Code (data field) available from the bridge. If there is no field/data available that can be read, the setup process will fail (with the message that no connection is possible).

Additional entities to get status information about your Tibber Pulse IR itself

Beside the data that the Tibber Pulse IR is reading from your electricity meter, the device is also provide additional information about its own status. Since the assumption is that you want to read this additional status information with a much lower update-interval (less frequent) the usage of a REST-Entity template a (IMHO) simple way to archive your goal.

REST-Template in your HA configuration.yaml

requesting http://admin:[BRIDGE_PASSWORD]@[YOUR_IP]/metrics.json?node_id=1 will return a json like this one here

{
  "$type": "node_status",
  "node_status": {
    "product_id": 49344,
    "bootloader_version": 17563650,
    "meter_mode": 3,
    "node_battery_voltage": 3.127,
    "node_temperature": 22.51,
    "node_avg_rssi": -72.746,
    "node_avg_lqi": 186.438,
    "radio_tx_power": 190,
    "node_uptime_ms": 167656940,
    "meter_msg_count_sent": 75,
    "meter_pkg_count_sent": 237,
    "time_in_em0_ms": 8405,
    "time_in_em1_ms": 30,
    "time_in_em2_ms": 291717,
    "acmp_rx_autolevel_300": 146,
    "acmp_rx_autolevel_9600": 164
  },
  "hub_attachments": {
    "meter_pkg_count_recv": 237,
    "meter_reading_count_recv": 75,
    "node_version": "1007-56bd9fb9"
  }
}

Check if you have already a sensor section in your configuration.yaml file - if there is none - create one on as top level entry like this (the line ' - platforms: ...' must (obviously) be replaced with the complete sections shown further below):

sensor:
  - platform: ...

Add in the sensor section of your configuration.yaml file the following content: sections with [ CHANGE_ME:xxx ] have to be modified to your requirements. E.g. assuming your assuming password is 55AA-CC21, then you have to replace [ CHANGE_ME:YOUR_PASSWORD ] with just 55AA-CC21

  - platform: rest
    name: [ CHANGE_ME:Tibber Prices ]
    unique_id: [ CHANGE_ME:tibber_prices ]
    resource: http://admin:[ CHANGE_ME:YOUR_PASSWORD ]@[ CHANGE_ME:YOUR_IP ]/metrics.json?node_id=1
    method: GET
    json_attributes_path: "node_status"
    json_attributes:
      - node_temperature
      - node_avg_rssi
      - radio_tx_power
      - [ CHANGE_ME: add/remove as many of the node_status attributes you want to meassure/do not need ]
    value_template: "{{ value_json.node_status.node_battery_voltage | float }}"
    # the scan_interval will be specified in seconds...
    # for update every 5min use 300 (60sec * 5min = 300sec)
    # for update every 15min use 900 (60sec * 15min = 900sec)
    # for update every 1h use 3600 (60sec * 60min = 3600sec)
    # for update every 24h use 86400 (60sec * 60min * 24h = 86400sec)
    scan_interval: 900
    headers:
      Content-Type: application/json
      User-Agent: REST
    unit_of_measurement: [ CHANGE_ME:A_UNIT_HERE ]

Here is a complete example assuming the password is 55AA-CC21 the IP is 192.168.2.213, and you want to capture the node_battery_voltage as main entity information and all other children of the node_status as additional attributes of the entity that will be requested every 5 minutes:

  - platform: rest
    name: Tibber Pulse Metrics
    unique_id: tibber_pulse_metrics
    resource: http://admin:55AA-CC21@192.168.2.213/metrics.json?node_id=1
    method: GET
    json_attributes_path: "node_status"
    json_attributes:
      - node_temperature
      - node_avg_rssi
      - node_avg_lqi
      - radio_tx_power
      - node_uptime_ms
      - meter_msg_count_sent
      - meter_pkg_count_sent
      - time_in_em0_ms
      - time_in_em1_ms
      - time_in_em2_ms
      - acmp_rx_autolevel_300
      - acmp_rx_autolevel_9600
    value_template: "{{ value_json.node_status.node_battery_voltage | float }}"
    scan_interval: 300
    headers:
      Content-Type: application/json
      User-Agent: REST
    unit_of_measurement: V

Here just another example with just a single value (without additional atributes) that will update every hour (just again have in mind, that this yaml section have to be under your sensor section of your configuration.yaml file):

  - platform: rest
    name: Tibber Pulse Metrics
    unique_id: tibber_pulse_metrics
    resource: http://admin:55AA-CC21@192.168.2.213/metrics.json?node_id=1
    method: GET
    value_template: "{{ value_json.node_status.node_battery_voltage | float }}"
    scan_interval: 3600
    headers:
      Content-Type: application/json
      User-Agent: REST
    unit_of_measurement: V