May 26, 20233 yr drop my the energyMode one as well to test I'm getting an error if I try to edit it to the same float setting.
May 26, 20233 yr 42 minutes ago, -cK- said: drop my the energyMode one as well to test I'm getting an error if I try to edit it to the same float setting. {% if (state_attr('sensor.sunsynk_settings', 'energyMode') | float) == 1 %} on {% else %} off {% endif %} ok found the problem, needed to remove the : that was in the original line I tried converting -edit- For ease of reference: - sensor: - name: "Current Use Timer 248" state: > {% if (state_attr('sensor.sunsynk_settings', 'peakAndVallery') | float) == 1 %} on {% else %} off {% endif %} - sensor: - name: "Energy Mode 243" state: > {% if (state_attr('sensor.sunsynk_settings', 'energyMode') | float) == 1 %} on {% else %} off {% endif %} Edited May 26, 20233 yr by -cK- Additional info provided
May 27, 20233 yr @slipx & @-cK- Excellent work on the cards guys, just a suggestion to add a feature if you're open to it/ in the mood: implement additional info like rate of charge kWh (x%/h) rate of discharge (y%/h) additionally a display of 'approximate hours to full charge' with displaying the time at full charge assuming at constant rate (would be way more technical to also implement expected/ predicted solar correction). So that i can easily see at current charge rate expected full charge will be at 3pm vs 8pm aka indicating i should intervene if it's after 5pm... with a symbol changing colour etc..
May 27, 20233 yr 1 hour ago, SteveRCT said: @slipx & @-cK- Excellent work on the cards guys, just a suggestion to add a feature if you're open to it/ in the mood: implement additional info like rate of charge kWh (x%/h) rate of discharge (y%/h) additionally a display of 'approximate hours to full charge' with displaying the time at full charge assuming at constant rate (would be way more technical to also implement expected/ predicted solar correction). So that i can easily see at current charge rate expected full charge will be at 3pm vs 8pm aka indicating i should intervene if it's after 5pm... with a symbol changing colour etc.. Have a look at the latest release. It includes the time to full charge.
May 28, 20233 yr @slipx The battery shutdown SOC is done on a static value but I was wondering could one link it the timer SOC when it is discharging and the timer is set to on? So probably an oversimplification but the logic would be something down the line of: Check time (now), determine the timeslot to pull soc from (unless there is another way to see which timeslot is currently active in the setting attributes) Then: If grid is online calculation is based on the timeslot SOC, if grid is offline it is based of the set shutdown SOC of XX. Was thinking it could be a nice option to see how long you will be able run on your battery till you hit your SOC and go over to grid and when the power is off you get the full runtime to shutdown calculation. Will be much easier than trying to explain to the none tech savvy folk in the house how to calculate battery runtime when discharging during high peak usage 😅 Perhaps even set it as an option to enable or disable this method 🤷♂️ Just a thought
May 28, 20233 yr It sounds complicated and will require some thought. The timeslot is reported as a string so you need to convert it to a date format. It also requires another 12 sensors, one for each time slot and timeslot SOC. My initial thoughts are it falls outside of the scope of this card. BTW I just released v1.5.0 of the card that includes the optional addition of remaining solar forecast for the day. I've also included the actual time that the battery will be fully charged or shutdown SOC reached based on the suggestion of @SteveRCT
May 28, 20233 yr @slipx I've been fiddling with it a bit using your old card sensor template as a testing ground and this is what I've come up with so far that will change the calculation based on the current time slot SOC. Might be of assistance but if this falls outside of the scope of the card I understand. battery_cap: friendly_name: "Battery Capacity" value_template: > {% set now = strptime(as_timestamp(now()) | timestamp_custom('%H:%M'), '%H:%M') %} {% set sellTime1 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime1'), '%H:%M') %} {% set sellTime2 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime2'), '%H:%M') %} {% set sellTime3 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime3'), '%H:%M') %} {% set sellTime4 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime4'), '%H:%M') %} {% set sellTime5 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime5'), '%H:%M') %} {% set sellTime6 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime6'), '%H:%M') %} {% if now >= sellTime1 and now < sellTime2 %} {{ state_attr('sensor.sunsynk_settings', 'cap1') | float }} {% elif now >= sellTime2 and now < sellTime3 %} {{ state_attr('sensor.sunsynk_settings', 'cap2') | float }} {% elif now >= sellTime3 and now < sellTime4 %} {{ state_attr('sensor.sunsynk_settings', 'cap3') | float }} {% elif now >= sellTime4 and now < sellTime5 %} {{ state_attr('sensor.sunsynk_settings', 'cap4') | float }} {% elif now >= sellTime5 and now < sellTime6 %} {{ state_attr('sensor.sunsynk_settings', 'cap5') | float }} {% elif now >= sellTime6 or now < sellTime1 %} {{ state_attr('sensor.sunsynk_settings', 'cap6') | float }} {% else %} 0 {% endif %} soc_battery_time_left: friendly_name: "Battery Depletion Seconds" unit_of_measurement: Seconds value_template: > {% set state = states('sensor.sunsynk_battery_power') | int %} {% set cap = states('sensor.battery_cap') | float %} {% if state == 0 %} {{ ((((states('sensor.sunsynk_battery_soc') | float - cap) / 100) * 10240) / 1 * 60 * 60) | int }} {% else %} {{ ((((states('sensor.sunsynk_battery_soc') | float - cap) / 100) * 10240) / (states('sensor.sunsynk_battery_power') | float) * 60 * 60) | int }} {% endif %} soc_battery_time_left_friendly: friendly_name: "Battery Depletion Time" value_template: > {% set state = states('sensor.sunsynk_battery_power') | int %} {% if state > 0 -%} {%- set time = states('sensor.soc_battery_time_left') | int %} {%- set minutes = ((time % 3600) // 60) %} {%- set minutes = '{} minutes'.format(minutes) if minutes > 0 else '' %} {%- set hours = ((time % 86400) // 3600) %} {%- set hours = '{} hours, '.format(hours) if hours > 0 else '' %} {%- set days = (time // 86400) %} {%- set days = '{} day, '.format(days) if days > 0 else '' %} {{ 'Less than 1 minute' if time < 60 else days + hours + minutes }} {%- else -%} {{ 'Running on solar power' }} {%- endif %} Edited May 28, 20233 yr by -cK- Typo
May 28, 20233 yr Made a small alteration to the above to first check the grid status so to return the "shutdown" value (in my code this is a fixed value but this could be modified I believe to pull the shutdown value that one set in the card parameters perhaps). So when the power is out it will base the calculation on the shutdown % and not the SOC limits battery_cap: friendly_name: "Battery Capacity" value_template: > {% set grid_online = states('sensor.sunsynk_grid_online') | float %} {% if grid_online | float == 0 %} 20 {% else %} {% set now = strptime(as_timestamp(now()) | timestamp_custom('%H:%M'), '%H:%M') %} {% set sellTime1 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime1'), '%H:%M') %} {% set sellTime2 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime2'), '%H:%M') %} {% set sellTime3 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime3'), '%H:%M') %} {% set sellTime4 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime4'), '%H:%M') %} {% set sellTime5 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime5'), '%H:%M') %} {% set sellTime6 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime6'), '%H:%M') %} {% if now >= sellTime1 and now < sellTime2 %} {{ state_attr('sensor.sunsynk_settings', 'cap1') | float }} {% elif now >= sellTime2 and now < sellTime3 %} {{ state_attr('sensor.sunsynk_settings', 'cap2') | float }} {% elif now >= sellTime3 and now < sellTime4 %} {{ state_attr('sensor.sunsynk_settings', 'cap3') | float }} {% elif now >= sellTime4 and now < sellTime5 %} {{ state_attr('sensor.sunsynk_settings', 'cap4') | float }} {% elif now >= sellTime5 and now < sellTime6 %} {{ state_attr('sensor.sunsynk_settings', 'cap5') | float }} {% elif now >= sellTime6 or now < sellTime1 %} {{ state_attr('sensor.sunsynk_settings', 'cap6') | float }} {% else %} 0 {% endif %} {% endif %} Edited May 28, 20233 yr by -cK- Additional information
May 29, 20233 yr Hi thanks so much for this! its working like a charm. One thing, I have 16kw inverter and i was wondering if there is any way to get the 3rd string displaying. Thanks again Jacques
May 29, 20233 yr 2 hours ago, Jacques Jambo said: Hi thanks so much for this! its working like a charm. One thing, I have 16kw inverter and i was wondering if there is any way to get the 3rd string displaying. Thanks again Jacques Yes, just change mppts:three under solar Edited May 29, 20233 yr by spotity
May 29, 20233 yr I've done some more work on the markdown card and sensors to try and do the same on the charging side to give myself an estimated time it will take to reach my current timeslot SOC when charging and when the SOC is reached it should then give me the time to reach 100%. Well that is in theory what I'm trying to do but will have to test this out tomorrow to see if it is working as intended. Not sure how useful this will be for others but for me it is just an aid to get a quick idea of the state of charging/discharging without having to do all these calculations in my head. If it work and I've ironed out all the little issues I still have with it I'll post the updated templates. @slipx Any reason you opted to have the shutdown value as a fixed input value instead of pulling it from the sensor data? I've used this in my updated sensors to pull the value instead of having it as a fixed value: {{ (states.sensor.sunsynk_settings.attributes.batteryShutdownCap) | float }} So it will auto adjusts if you change the shutdown settings (not that you do it often but one less thing to remember to change if you change settings) 🤷♂️ ---Edit--- Just a few screenshots from my testing and debugging of the code thus far: SOC = 25 (So it give you runtime to a full charge) SOC = 35 (So it give me the runtime to reach the SOC and when the SOC is reached it goes to 100) Battery above the current SOC so it give me the time until it will reach the SOC of 25 (note the slipx's card will be to shutdown value which is actually nice to have both times up at the same time) and when the power is out it will give you the runtime to shutdown value @slipx considering how many variables there are to keep track of maybe it should be an optional "addon" to the card instead of being integrated into the card. Something people can rather choose to copy to their config file and then just setup the markdown card together with your card if they want to use is. Once I'm happy everything is working the way I want it I'll post all of the code so that you can evaluate for yourself. Like you said perhaps outside of the scope of the cards itself and a bit of a niche use case. 😉 Edited May 30, 20233 yr by -cK- Additional information
May 30, 20233 yr 16 hours ago, -cK- said: Any reason you opted to have the shutdown value as a fixed input value instead of pulling it from the sensor data? I've used this in my updated sensors to pull the value instead of having it as a fixed value: The original thinking was you could manually adjust this based on on other variables and your own energy management preferences. It's referenced as shutdown SOC but its just working out the time to discharge to the target. Ii may not be actual shutdown SOC i.e. a specific time slot SOC you want to monitor. 16 hours ago, -cK- said: considering how many variables there are to keep track of maybe it should be an optional "addon" to the card instead of being integrated into the card. I like the idea of an optional add-on.
May 30, 20233 yr 2 hours ago, slipx said: I like the idea of an optional add-on. Cool I'm gonna run this for another day or so just to make sure I didn't miss any weird random scenrio I didn't think of that will make it freak out.
May 31, 20233 yr @slipx Think I've got all the major bugs ironed out so here is the code for that add-on: Template sensors needed in the configuration file: ##### ##### ##### Sunsynk-Power-Flow-Card: Add-On ##### Markdown Sensors Template ##### ##### battery_cap: friendly_name: "Battery Capacity" value_template: > {% set grid_online = states('sensor.sunsynk_grid_online') | float %} {% if grid_online | float == 0 %} {{ (states.sensor.sunsynk_settings.attributes.batteryShutdownCap) | float }} {% else %} {% set now = strptime(as_timestamp(now()) | timestamp_custom('%H:%M'), '%H:%M') %} {% set sellTime1 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime1'), '%H:%M') %} {% set sellTime2 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime2'), '%H:%M') %} {% set sellTime3 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime3'), '%H:%M') %} {% set sellTime4 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime4'), '%H:%M') %} {% set sellTime5 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime5'), '%H:%M') %} {% set sellTime6 = strptime(state_attr('sensor.sunsynk_settings', 'sellTime6'), '%H:%M') %} {% if now >= sellTime1 and now < sellTime2 %} {{ state_attr('sensor.sunsynk_settings', 'cap1') | float }} {% elif now >= sellTime2 and now < sellTime3 %} {{ state_attr('sensor.sunsynk_settings', 'cap2') | float }} {% elif now >= sellTime3 and now < sellTime4 %} {{ state_attr('sensor.sunsynk_settings', 'cap3') | float }} {% elif now >= sellTime4 and now < sellTime5 %} {{ state_attr('sensor.sunsynk_settings', 'cap4') | float }} {% elif now >= sellTime5 and now < sellTime6 %} {{ state_attr('sensor.sunsynk_settings', 'cap5') | float }} {% elif now >= sellTime6 or now < sellTime1 %} {{ state_attr('sensor.sunsynk_settings', 'cap6') | float }} {% else %} {{ (states.sensor.sunsynk_settings.attributes.batteryShutdownCap) | float }} {% endif %} {% endif %} soc_battery_time_left: friendly_name: "Battery Depletion Seconds" unit_of_measurement: Seconds value_template: > {% set state = states('sensor.sunsynk_battery_power') | int %} {% set cap = states('sensor.battery_cap') | float %} {% if state == 0 %} {{ ((((states('sensor.sunsynk_battery_soc') | float - cap) / 100) * 10240) / 1 * 60 * 60) | int }} {% else %} {{ ((((states('sensor.sunsynk_battery_soc') | float - cap) / 100) * 10240) / (states('sensor.sunsynk_battery_power') | float) * 60 * 60) | int }} {% endif %} soc_battery_time_left_friendly: friendly_name: "Battery Depletion Time" value_template: > {% set state = states('sensor.sunsynk_battery_power') | int %} {% if state > 0 -%} {%- set time = states('sensor.soc_battery_time_left') | int %} {%- set minutes = ((time % 3600) // 60) %} {%- set minutes = '{} min'.format(minutes) if minutes > 0 else '' %} {%- set hours = ((time % 86400) // 3600) %} {%- set hours = '{} hrs, '.format(hours) if hours > 0 else '' %} {%- set days = (time // 86400) %} {%- set days = '{} day, '.format(days) if days > 0 else '' %} {{ 'Floating' if time < 60 else days + hours + minutes }} {%- else -%} {{ 'Charging' }} {%- endif %} battery_charging_time_left: friendly_name: "Battery Charging Time Left" unit_of_measurement: Seconds value_template: > {% set power = states('sensor.sunsynk_battery_power') | float %} {% set soc = states('sensor.sunsynk_battery_soc') | float %} {% set cap = states('sensor.battery_cap') | float %} {% if power < 0 %} {% if soc < cap %} {{ ((((cap - soc) / 100) * 10240) / (-power) * 60 * 60) | int }} {% else %} {{ ((((100 - soc) / 100) * 10240) / (-power) * 60 * 60) | int }} {% endif %} {% else %} 0 {% endif %} battery_charging_time_left_friendly: friendly_name: "Battery Charging Time" value_template: > {% set state = states('sensor.sunsynk_battery_power') | int %} {% if state < 0 -%} {%- set time = states('sensor.battery_charging_time_left') | int %} {%- set minutes = ((time % 3600) // 60) %} {%- set minutes = '{} min'.format(minutes) if minutes > 0 else '' %} {%- set hours = ((time % 86400) // 3600) %} {%- set hours = '{} hrs, '.format(hours) if hours > 0 else '' %} {%- set days = (time // 86400) %} {%- set days = '{} day, '.format(days) if days > 0 else '' %} {{ 'Floating' if time < 60 else days + hours + minutes }} {%- else -%} {{ 'Discharging' }} {%- endif %} markdown_battery_charge_time_left: friendly_name: "Markdown Battery Charging Time" value_template: > {% if states('sensor.sunsynk_battery_soc') | float < states('sensor.battery_cap') | float %} {{ states('sensor.battery_cap') | float | round(0) }} {% else %} 100 {% endif %} markdown_discharge_time: friendly_name: "Markdown Discharge Time" value_template: > {% set now = as_timestamp(now()) %} {% set add = states('sensor.soc_battery_time_left') | int %} {% set future_time = now + add %} {{ future_time | timestamp_custom('%H:%M') }} markdown_charge_time: friendly_name: "Markdown Charging Time" value_template: > {% set now = as_timestamp(now()) %} {% set add = states('sensor.battery_charging_time_left') | int %} {% set future_time = now + add %} {{ future_time | timestamp_custom('%H:%M') }} battery_status: value_template: "{{ 'positive' if states('sensor.sunsynk_battery_power')|float > 0 else 'negative' }}" friendly_name: "Battery Status" 10240 is the battery size (2x5.12kW batteries so adjust this value accordingly to your setup) Then I have the different markdown cards setup as conditional cards below the Sunsynk Power Flow Card: - type: conditional conditions: - entity: sensor.battery_status state: positive card: type: markdown content: "<table width=\"100%\" border=0>\n <tbody> \n <tr>\n <td align=\"center\">\n <b>Discharge to {{ states('sensor.battery_cap') | float | round(0)}}% :\n {{ states('sensor.soc_battery_time_left_friendly') }} @ {{ states('sensor.markdown_discharge_time') }}</b> \n \t</td>\n </tr>\n </tbody>\n</table>" - type: conditional conditions: - entity: sensor.battery_status state: negative card: type: markdown content: "<table width=\"100%\" border=0>\n <tbody> \n <tr>\n <td align=\"center\">\n <b>Charge to {{ states('sensor.markdown_battery_charge_time_left') | float | round(0)}}% : \n {{ states('sensor.battery_charging_time_left_friendly') }} @ {{ states('sensor.markdown_charge_time') }}</b> \n \t</td>\n </tr>\n </tbody>\n</table>" - type: conditional conditions: - entity: sensor.battery_status state: unavailable card: type: markdown content: "<table width=\"100%\" border=0>\n <tbody> \n <tr>\n <td align=\"center\">\n <b>Houston, we have a Problem</b> \n \t</td>\n </tr>\n </tbody>\n</table>\n" Think that is everything needed for this add-on to work. Note that I'm using Gary's integration to pull the inverter data so not sure what the sensors would be on the other integrations like Solarman etc. sorry. Edited May 31, 20233 yr by -cK- Typo
June 2, 20233 yr On 2023/05/29 at 12:50 PM, spotity said: Yes, just change mppts:three under solar Hi where exactly do you do this? Still havent figured it out
June 2, 20233 yr 1 hour ago, Jacques Jambo said: Hi where exactly do you do this? Still havent figured it out Edit the dashboard Select edit on the card Change the attribute MPPT under solar to three
June 2, 20233 yr 2 hours ago, spotity said: Edit the dashboard Select edit on the card Change the attribute MPPT under solar to three
June 2, 20233 yr Hi ok I have figure most of this out. Got the flow card working finally. But it seems the sunsynk integration is not pulling any data from pv 3. I noticed on the phone app only the first 2 strings show up but the desktop version shows all 3 strings.
June 2, 20233 yr 5 minutes ago, Jacques Jambo said: Hi ok I have figure most of this out. Got the flow card working finally. But it seems the sunsynk integration is not pulling any data from pv 3. I noticed on the phone app only the first 2 strings show up but the desktop version shows all 3 strings. Probably need to include the mppt in your template sensors, currently only 2 in the template, current one should look similar to this, add the 3rd one for voltage and current. - sensor: - name: "Sunsynk PV1 186" state: > {{state_attr('sensor.sunsynk_input', 'pv1')|float(0)|round(0)}} - sensor: - name: "Sunsynk PV2 187" state: > {{state_attr('sensor.sunsynk_input', 'pv2')|float(0)|round(0)}} - sensor: - name: "Sunsynk PV1 Voltage 109" state: > {{state_attr('sensor.sunsynk_input', 'pvIV_0_vpv')|float(0)|round(1)}} - sensor: - name: "Sunsynk PV1 Current 110" state: > {{state_attr('sensor.sunsynk_input', 'pvIV_0_ipv')|float(0)|round(1)}} - sensor: - name: "Sunsynk PV2 Voltage 111" state: > {{state_attr('sensor.sunsynk_input', 'pvIV_1_vpv')|float(0)|round(1)}} - sensor: - name: "Sunsynk PV2 Current 112" state: > {{state_attr('sensor.sunsynk_input', 'pvIV_1_ipv')|float(0)|round(1)}} Edited June 2, 20233 yr by spotity
June 2, 20233 yr Ok so this is where im at. I have managed to change everything in the config files but still cant get the wattage from pv3. Its giving me the amps and the volatge but no luck with the wattage?
June 2, 20233 yr Have a look at developer tools and the attributes being reported for sensor.suinsynk_input. If you don't see it there then its an issue with the integration
June 2, 20233 yr Taking a stab in the dark but Perhaps those might be under input_2 instead of input?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.