bphermansson / EspSparsnasGateway

Reads data from Ikea Sparsnäs energy meter and publish via Mqtt.
MIT License
39 stars 27 forks source link

Enable second transmitter id #50

Closed SweNilsson closed 4 years ago

SweNilsson commented 4 years ago

By monitoring more than one energy meter at home it would be possible to keep consumption from the Car and the Heating system on separate "tabs". I imagine that the code change would be rather small, but I can't achieve this myself with my lacking programming skills. My current need is to receive data from two transmitters.

My idea to solve the need: Setup transmitter_id2 in settings.h either add watt2, total2 and battery2 to the MQTT message or create a separate message in case two transmitter ids have been set.

Sperra commented 4 years ago

You can try this one: https://github.com/Sperra/EspSparsnasGateway

SweNilsson commented 4 years ago

Thanks @Sperra ! What is the json value ids? I've tried to check the code but I'm not qualified to read it. Today I have a sensor reading this "value_json.watt" but now I need two different I guess?

Sperra commented 4 years ago

During startup and initializing it uses the following for information and debug. EspSparsnasGateway/values EspSparsnasGateway/debug

Meassurment are sent with the following EspSparsnasGateway/Sensor1/values EspSparsnasGateway/Sensor1/debug EspSparsnasGateway/Sensor2/values EspSparsnasGateway/Sensor2/debug

Values are the same as before: seq, timestamp, watt, total, battery and rssi

I have the following setup for wat in my OpenHAB Number sensors_sparsnas_watt "watt [%.1f W]" (gpower) {mqtt="<[mosquitto:EspSparsnasGateway/Sensor1/values:state:JSONPATH($.watt)]"}

SweNilsson commented 4 years ago

Great! Exactly what I was looking for

bphermansson commented 4 years ago

Great work! Just wished it'd been a PR here instead of a fork.

Sperra commented 4 years ago

Sprry my faiult! Totaly new to GitHub. I will try to do a PR during het weekend.

dogmatic69 commented 4 years ago

It's easy to make a PR from a fork

It needs cleaning up before being merged though.