Any updates to this? That panel looks great and I’m wondering how much further you took it
Life got busy (actually it thawed outside -> yardwork!!) and this “workedish” so I haven’t done much beyond what’s above. I want to get the weather report for the next 3 days on there as well but got hung up with some of the minutiae. I have a boring work meeting tonight… maybe I can tinker a bit!
Any ideas on this?
I’m trying to get the state of pws_temp_low_2d_f
but the state
entity_id is something different (in this case it’s sensor.pws_weather_2d
.
I’ve tried s = state.pws_temp_low_2d_f
and s = state.attributes.pws_temp_low_2d_f
but it just returns undefined. Clearly it’s not going to work because state
points to something else. But without changing state
I’m not sure what to do. Any ideas?
Here’s the relevant code:
function set_view(self, state) {
if (state.entity_id == "sensor.pws_weather_2d"
|| state.entity_id == "sensor.pws_weather_3d"
|| state.entity_id == "sensor.pws_weather_4d"
|| state.entity_id == "sensor.pws_weather_5d"
|| state.entity_id == "sensor.pws_weather_6d") {
s = state.attributes.friendly_name
s += " <img src=\"http://192.168.25.80/VCloudsWeatherIcons/"
s += state.attributes.entity_picture.split("/")[6].split(".")[0]
s += ".png\" height=20% width=20%> "
high_temp_var = "pws_temp_high_"
high_temp_var += state.entity_id.split("_")[2]
high_temp_var += "_f"
low_temp_var = "pws_temp_low_"
low_temp_var += state.entity_id.split("_")[2]
low_temp_var += "_f"
s += state.high_temp_var
s += " / "
s += low_temp_var
field = state.entity_id.split(".")[1]
self.set_field(self, field, s)
}
I’m basically trying to get the state of pws_temp_high_1d_f
(and 2d and 3d respectively).
So that when I display it, it’ll show the friendly_name
and entity_picture
from sensor.pws_weather_2d
followed by high and low (i.e. pws_temp_high_1d_f
/ pws_temp_low_1d_f
=> “80˚ / 65˚”)
the best i can think off is that you look at the js from other widgets that use more then 1 entity.
and the only one i can think of at the moment is the original weather widget.