I have a Bright CAD device (SMETS Secure 1) and have managed to integrate this into my HASS with MQTT (At long last).
Whenever I get a minus figure for my use (i.e. I’m exporting) the system gives a huge random figure (15million or example) which will limit me being able to automate with it how I would like.
I believe I need to have a value template that states to not show anything when the figure is minus to correct this, but I can’t see how I do this? I tried to create a template but the system errored stating invalid option for MQTT?
This impacts at least my “Home instant Electricity” sensor and the “Home Instant Export” any help is very greatly received.
Edit: Home Instant shows a value of 15million, but export is showing nothing to clarify the impact.
sensor:
- state_topic: "SMART/HILD/[MAC]"
name: "Home Instant Electricity"
unit_of_measurement: "W"
value_template: "{{ value_json['elecMtr']['0702']['04']['00']|int(base=16) }}"
icon: "mdi:flash"
device_class: energy
- state_topic: "SMART/HILD/[MAC]"
name: "Home Electricity"
unit_of_measurement: "kWh"
value_template: "{{ value_json['elecMtr']['0702']['00']['00']|int(base=16) * value_json['elecMtr']['0702']['03']['01']|int(base=16) / value_json['elecMtr']['0702']['03']['02']|int(base=16) }}"
icon: "mdi:flash"
device_class: energy
- state_topic: "SMART/HILD/[MAC]"
name: "Home Daily Electricity"
unit_of_measurement: "kWh"
value_template: "{{ value_json['elecMtr']['0702']['04']['01']|int(base=16) * value_json['elecMtr']['0702']['03']['01']|int(base=16) / value_json['elecMtr']['0702']['03']['02']|int(base=16) }}"
icon: "mdi:flash"
device_class: energy
- state_topic: "SMART/HILD/[MAC]"
name: "Home Weekly Electricity"
unit_of_measurement: "kWh"
value_template: "{{ value_json['elecMtr']['0702']['04']['30']|int(base=16) * value_json['elecMtr']['0702']['03']['01']|int(base=16) / value_json['elecMtr']['0702']['03']['02']|int(base=16) }}"
icon: "mdi:flash"
device_class: energy
- state_topic: "SMART/HILD/[MAC]"
name: "Home Monthly Electricity"
unit_of_measurement: "kWh"
value_template: "{{ value_json['elecMtr']['0702']['04']['40']|int(base=16) * value_json['elecMtr']['0702']['03']['01']|int(base=16) / value_json['elecMtr']['0702']['03']['02']|int(base=16) }}"
icon: "mdi:flash"
device_class: energy
- state_topic: "SMART/HILD/[MAC]"
name: "Home Gas"
unit_of_measurement: "m3"
value_template: "{{ value_json['gasMtr']['0702']['00']['00']|int(base=16) * value_json['gasMtr']['0702']['03']['01']|int(base=16) / value_json['gasMtr']['0702']['03']['02']|int(base=16) }}"
icon: "mdi:flash"
device_class: gas
- state_topic: "SMART/HILD/[MAC]"
name: "Home Daily Gas"
unit_of_measurement: "m3"
value_template: "{{ value_json['gasMtr']['0702']['0C']['01']|int(base=16) * value_json['gasMtr']['0702']['03']['01']|int(base=16) / value_json['gasMtr']['0702']['03']['02']|int(base=16) }}"
icon: "mdi:flash"
device_class: gas
state_class: 'total_increasing'
- state_topic: "SMART/HILD/[MAC]"
name: "Home Weekly Gas"
unit_of_measurement: "kWh"
value_template: "{{ value_json['gasMtr']['0702']['0C']['30']|int(base=16) * value_json['gasMtr']['0702']['03']['01']|int(base=16) / value_json['gasMtr']['0702']['03']['02']|int(base=16) }}"
icon: "mdi:flash"
device_class: gas
state_class: 'total_increasing'
- state_topic: "SMART/HILD/[MAC]"
name: "Home Monthly Gas"
unit_of_measurement: "kWh"
value_template: "{{ value_json['gasMtr']['0702']['0C']['40']|int(base=16) * value_json['gasMtr']['0702']['03']['01']|int(base=16) / value_json['gasMtr']['0702']['03']['02']|int(base=16) }}"
icon: "mdi:flash"
device_class: gas
state_class: 'total_increasing'
- state_topic: "SMART/HILD/[MAC]"
name: "Home Current Electricity Usage"
unit_of_measurement: "kWh"
value_template: "{{ value_json['elecMtr']['0702']['04']['00']|int(base=16) }}"
icon: "mdi:speedometer"
device_class: energy
#state_class: 'total_increasing'
- state_topic: "SMART/HILD/[MAC]"
name: "Home Instant Export"
unit_of_measurement: "kWh"
value_template: "{{ value_json['elecMtr']['0702']['00']['01']|int(base=16) }}"
icon: "mdi:flash"
device_class: energy
- state_topic: "SMART/HILD/[MAC]"
name: "Home Electricity Export Meter"
unit_of_measurement: "kWh"
value_template: "{{ (value_json['elecMtr']['0702']['00']['01']|int(base=16) * value_json['elecMtr']['0702']['03']['01']|int(base=16) / value_json['elecMtr']['0702']['03']['02']|int(base=16)) }}"
icon: "mdi:counter"
device_class: energy
state_class: total_increasing
- state_topic: "SMART/HILD/[MAC]"
name: "Home Gas Meter M3"
last_reset_value_template: homeassistant.util.dt.utc_from_timestamp(0)
unit_of_measurement: "m3"
#value_template: "{{ value_json['gasMtr']['0702']['00']['00']|int(base=16) * value_json['gasMtr']['0702']['03']['01']|int(base=16) / value_json['gasMtr']['0702']['03']['02']|int(base=16) }}"
icon: "mdi:counter"
device_class: gas
state_class: total_increasing
value_template: "{{ ( ( states('sensor.home_gas_meter_m3') | int ) * 1.02264 * 38.9 / 3.6 ) | round(1) }}"```