Unable to set sensor entity state

Thanks for the hint.
If anybody interested it is this post.