Hi,
I have a smart power meter and I have set the price per KW/h in energy setup.
My problem is, that the calculated cost begins at zero. I want to set it my own value (in developer tools-> state->set state), but this is not possible (get overwritten asap). I also tested to delete all values from home-assistant_v2.db and insert them how I want them, with the fellow SQL commands (ha was stopped before):
DELETE FROM events WHERE event_id IN (SELECT event_id FROM states WHERE entity_id = 'sensor.pm1_kwh_cost');
DELETE FROM states WHERE entity_id = 'sensor.pm1_kwh_cost';
INSERT INTO "main"."states" ("state_id", "domain", "entity_id", "state", "attributes", "event_id", "last_changed", "last_updated", "created", "old_state_id")
VALUES ('3104525', 'sensor', 'sensor.pm1_kwh_cost', '0', '{"state_class":"total","last_reset":"2021-12-21T12:26:00.000000+00:00","unit_of_measurement":"EUR","device_class":"monetary","friendly_name":"Stromz\u00e4hler Z\u00e4hlerstand Cost"}', '3129327', '2021-12-21 12:26:00.000000', '2021-12-21 12:26:00.000000', '2021-12-21 12:26:00.000000', '');
INSERT INTO "main"."states" ("state_id", "domain", "entity_id", "state", "attributes", "event_id", "last_changed", "last_updated", "created", "old_state_id")
VALUES ('3104528', 'sensor', 'sensor.pm1_kwh_cost', '125.3439', '{"state_class":"total","last_reset":"2021-12-21T12:26:00.000000+00:00","unit_of_measurement":"EUR","device_class":"monetary","friendly_name":"Stromz\u00e4hler Z\u00e4hlerstand Cost"}', '3129330', '2022-01-11 13:25:34.322148', '2022-01-15 17:50:34.322148', '2022-01-15 17:50:34.322148', '3104525');
INSERT INTO "main"."events" ("event_id", "event_type", "event_data", "origin", "time_fired", "created", "context_id", "context_user_id", "context_parent_id")
VALUES ('3129327', 'state_changed', '{}', 'LOCAL', '2021-12-21 12:26:00.000000', '2021-12-21 12:26:00.000000', 'bdb89f1c7c9aa7feeaa32f9ffb982a55', '', '');
INSERT INTO "main"."events" ("event_id", "event_type", "event_data", "origin", "time_fired", "created", "context_id", "context_user_id", "context_parent_id")
VALUES ('3129330', 'state_changed', '{}', 'LOCAL', '2022-01-15 17:50:34.322148', '2022-01-15 17:50:34.322148', '2437ef543a68073be6fe454a3b4301f9', '', '');
I tested with one state/event and also with two… it is always the same. The two state_ids/event_ids are the one I deleted before. I calculated my cost to the date and counter number, which I submitted to my energy provider.
This cost is the only one which is also really interesting, because it is what I will pay at the end.
Has anybody an idea how to do it?
Thanks in Advanced.