Skip to main content

ha-mqtt-discoverable project to get temperature, pressure and humidity from a bme280 chip

Project description

discoverable-tph-280

Table of Contents

Prerequisites

Install the module if you haven't already

See README_ui.md for module installation

MQTT broker configuration

This code has only been tested with an external MQTT broker. I used Eclipse Mosquitto from https://mosquitto.org/. I had trouble using the internal MQTT broker, probably because of port forwarding issues due to running under docker.

Make sure the MQTT integration is installed on the Home Assistant server.

  • Click Settings
  • Click Devices and Services
  • Click Integrations You should find MQTT listed, if not perform the following to install:
  • Click the blue button in the lower right hand corner labeled ADD INTEGRATION
  • Enter MQTT in the search
  • Click MQTT in the list of integrations (it's probably the only one)
  • You'll get a list of MQTT integrations, click the one that says only MQTT If the MQTT integration is installed, do the following:
  • Click the MQTT icon
  • Click Configure
  • Click RE-CONFIGURE MQTT Once you have ensured that the MQTT integration is installed, continue with the following to verify the correct parameters.
  • Enter the Broker (the name or address of you MQTT broker)
  • Enter the port for your MQTT broker, 1883 is the default, but use whatever is neede by the MQTT broker
  • Enter the username, I believe homeassistant is the default
  • Enter the password
  • For MQTT protocol, use 5, 3.1 has been deprecated but will probably work.
  • Click Next in the bottom right
  • For Enable discovery, click the Enable button, if necessary, to enable
  • For Discovery prefix, enter homeassistant, I believe this is the default
  • Enable Birth messages, click the Enable button, if necessary, to enable
  • For Birth message topic, enter homeassistant/status
  • For birth message payload, enter online
  • Click Submit

Module configuration

Specify location of the configuration file

The location of the configuration file is specified in the "config" environment variable. This form is primarily used for starting the module as a service, in which case it is specified as followed in the modules service file:

Environment="config=/etc/discoverable-tph-280/discoverable-tph-280.config"

This is the default if you use "make install" to install the service.

If the config environment variable is not found, then the filesystem is searched in the following order:

  1. .config.yaml in the current directory
  2. config.yaml in the module directory

Configuration parameters

The contents of the .config.yaml file is as follows:

mqtt_broker: host: hastings.attlocal.net username: homeassistant password: wu2veeJoi5ox5ooP8wai9ich0oothaepaeg5keteu4mahwui9iexai7uNufae1sa discovery_prefix: homeassistant state_prefix: hmd gpio: port: 1 address: 0x76

Where the parameters have the following meaning:

  • host: the Broker specified in the MQTT broker configuration on the Home Assistant server
  • username: the username specified in the MQTT broker configuration on the Home Assistant server
  • password: the password specified in the MQTT broker configuration on the Home Assistant server
  • discovery_prefix: the Discovery Prefix specified in the MQTT broker configuration on the Home Assistant Server
  • state_prefix: the state_prefix that the Home Assistant server will use to send state information to the module, this can be of your choosing as this configuration parameter is sent to the Home Assistant server during handshake so that the Home Assistant server knows which prefix to use and therefore there is no place to configure it on the Home Assistant Server
  • port: the i2c port number used to communicate with the BME280 chip, normally 1
  • address: the device address on the i2c bus used to communicate with the BME280 chip, normally 0x76

ChangeLog

0.1.6 - 2023-08-29

  • thermometer.py change import from ha_hqtt_discoverable to ha_mqtt_discoverable

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

discoverable_tph_280-0.1.6.tar.gz (11.4 kB view hashes)

Uploaded Source

Built Distribution

discoverable_tph_280-0.1.6-py3-none-any.whl (13.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page