Was just thinking about this again and remembered the challenges I had setting all this up so here are a few things that some using this Jomjol AI thing may find useful.
this is what my panel looks like
starting with getting the data into home assistant, they probably aren’t all needed… but I have more than enough space on the hard drive.
mqtt:
sensor:
- name: Watermeter_reading
unique_id: a220223801
unit_of_measurement: "L"
state_class: total_increasing
state_topic: "WaterMeter/main/value"
- name: Watermeter_error
unique_id: a220223802
state_topic: "WaterMeter/main/error"
- name: Watermeter_json
unique_id: a220223803
state_topic: "WaterMeter/main/json"
- name: Watermeter_RSSI
unique_id: a220223804
unit_of_measurement: "dB"
state_topic: "WaterMeter/wifiRSSI"
- name: Watermeter_Timestamp
unique_id: a220223805
state_topic: "WaterMeter/main/timestamp"
- name: Watermeter_Raw
unique_id: a220223806
unit_of_measurement: "L"
state_topic: "WaterMeter/main/raw"
using the watermeter MQTT message to trigger an automation to download the image from the watermeter, this triggers even on miss reads making it useful with the logs off the device to see what’s happening
alias: watermeter picture
description: ''
trigger:
- platform: mqtt
topic: WaterMeter/main/json
condition: []
action:
- service: downloader.download_file
data:
url: http://192.168.1.60/img_tmp/alg_roi.jpg
subdir: watermeter
filename: >-
{{ states('sensor.watermeter_timestamp') | replace ( ':' , '-' )
}}_RAW-{{ states('sensor.watermeter_raw')
}}_Value-{{states('sensor.watermeter_reading')}}.jpg
- service: downloader.download_file
data:
url: http://192.168.1.60/img_tmp/alg_roi.jpg
filename: latest_reading.jpg
overwrite: true
mode: single
theres a few things to add to configuation.yaml to do this, under homeassistant i needed to add media_dirs: to allow me to browse old images easily from the frontend
homeassistant:
media_dirs:
watermeter: "/config/downloads"
for the downloader in the automation i needed to add this
downloader:
download_dir: downloads
so that the folder doesnt fill up too much i clear it out using a shell command
shell_command:
remove_watermeter_images: 'find /config/downloads/watermeter/* -mtime +3 -exec rm {} \;'
notice in the automation there is 2 downloads, one has a time date stamp, the other is latest_reading.jpg well i use this to have a have a camera on my dashboard always showing the latest image
camera:
- platform: local_file
file_path: /config/downloads/latest_reading.jpg
name: watermeter_image
i also like to have a few utility meters setup too,
utility_meter:
quaterhour_water:
source: sensor.watermeter_reading
cycle: quarter-hourly
tariffs:
- peak
daily_water:
source: sensor.watermeter_reading
cycle: daily
tariffs:
- peak
monthly_water:
source: sensor.watermeter_reading
tariffs:
- peak
and the lovelace panel i have setup to display the info
type: vertical-stack
cards:
- hours_to_show: 24
graph: line
type: sensor
entity: sensor.daily_water_peak
detail: 2
name: Water Today
- type: entities
entities:
- entity: sensor.watermeter_reading
name: Water Meter Reading
secondary_info: last-updated
icon: mdi:counter
- entity: sensor.watermeter_error
name: Error State
icon: mdi:water-alert
- entity: sensor.watermeter_rssi
name: RSSI
icon: mdi:signal-cellular-1
- entity: sensor.watermeter_json
name: Raw
secondary_info: last-changed
- show_state: false
show_name: false
camera_view: auto
type: picture-entity
entity: camera.watermeter_image
tap_action:
action: none
hold_action:
action: none